s g
s g

Reputation: 5637

Azure Web App unexpected "Bad Request"

I'm occasionally getting "Bad Request" in the Azure Console (located in the main 'blade' of the Azure web app). One example is when running npm install grunt-sass but there were several other times with different commands, all of which are valid commands that should execute immediately with no errors.

enter image description here

enter image description here

I think this is a bug in Azure. I haven't seen the problem when using the Kudu Diagnostic Console.

Why is this happening?

Upvotes: 0

Views: 1271

Answers (2)

user6269864
user6269864

Reputation:

I found that if you're having a "Bad Request" error while running the npm install command in Azure App Service's Console, the npm process is still running in the background and it will complete.

That means that you should not try to run npm i again until it completes. You can monitor the progress via FTP - when the .staging folder in node_modules is empty, that means installation is complete.

Upvotes: 1

Gary Liu
Gary Liu

Reputation: 13918

On my side, it looks like depends on the npm version in the Azure Web Apps sanbox. I upgrade the npm version to 4.2.0, and successfully installed grunt-sass both via Kudu Conosole, or App Service Editor's Console Tool.

Please navigate to Application settings blade of your Azure Web Apps, and add the WEBSITE_NPM_DEFAULT_VERSION configuration in App settings section:
enter image description here

Then, it should work as expected.

In Kudu Console:
enter image description here

In App Service Editor:enter image description here

At last, we recommend you can leverage custom deployment of Azure Web Apps, you can configure your dependencies in package.json, and deploy to Azure via Git, the deployment task will install the dependencies automatically, you can refer to Custom startup command for Node.js app on Azure with Babel 6 for the similar steps.

Upvotes: 1

Related Questions