I'm currently trying to deploy a windows web app in Azure. I am using Nodejs, and specifically it's a next.js react app w/ typescript. I am running into errors in the deployment to azure.
I'm using github actions pipeline to build and deploy the application and when run there, npm install and npm build work without issue. The problem is when I have the SCM_DO_BUILD_DURING_DEPLOYMENT app setting set to true then I receive a lint error on the Deploy to Azure step since it is rebuilding the application on the web app. The error is:
error - ESLint must be installed in order to run during builds: npm install --save-dev eslint
I have SCM_DO_BUILD_DURING_DEPLOYMENT set to true because I had read earlier that node has issues with Azure webapps linking node packages, so you need to run the build on the server.
The issue is that when I run the build during the deployment, I read that the command npm install --production gets run. When this runs, it installs my packages properly, but then when it does the postinstall build step, it fails with the above eslint error.
When I have SCM_DO_BUILD_DURING_DEPLOYMENT set to false then the deployment succeeds in my pipeline, but the application doesn't work.
In the windows app I am not able to see the error logs, but previously when I had been deploying this as a Linux app, it showed missing packages due to the node_modules linking issue, so I am thinking it's the same issue on windows. (To view application logs I went to Diagnose and Solve Problems -> Application Logs and on windows I don't get the same options, everything I click just shows me graphs so I'm not sure how to verify it's the same issue but it seems to be.
TLDR
How do I fix the eslint error and successfully deploy my next.js application? Here is my package.json:
package.json
"scripts": {
"dev": "node server.js",
"build": "next build",
"start": "node server.js",
"lint": "next lint",
"postinstall": "next build"
},
Am I just going about deploying a next.js application the wrong way on azure web app? Any guidance is appreciated. I've spent a few days trying to get this working at this point. Should I be creating a custom deploy script? I wasn't able to find documentation for doing that with node, but I see in the error output that the webapp runs
azure site deploymentscript -y --no-dot-deployment -r "C:\local\Temp\zipdeploy\extracted" -o "C:\home\site\deployments\tools" --node --sitePath "C:\local\Temp\zipdeploy\extracted"'. so is there a way to alter that?