Azure app service site fails during startup due to container error caused by NPM

Ford B 1 Reputation point
2023-04-26T06:55:46.8866667+00:00

Hello, I am a bit inexperienced when it comes to Azure, so please bear with me. I am hosting my API using Azure App Services, and recently I've been unable to get my app up and running, receiving error messages like this in the platform logs:

ERROR - Container *******-app-api-linux_*_******** didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.

When I check the container crash logs, I have an error message like this:

2023-04-26T06:18:06.365501169Z 2023-04-26T06:18:06.365504769Z SyntaxError: Unexpected token ?2023-04-26T06:18:06.365508370Z at new Script (vm.js:79:7)

And finally, the two parts of the app logs that appear to be the most relevant tell me this:

2023-04-26T06:17:52.971924685Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2023-04-26T06:17:52.974266418Z Could not find operation ID in manifest. Generating an operation id...
2023-04-26T06:17:52.975353934Z Build Operation ID: 84088a43-f913-4adc-af61-3af69fccd8a5
2023-04-26T06:17:53.939077746Z Environment Variables for Application Insight's IPA Codeless Configuration exists..
2023-04-26T06:17:54.007290409Z Writing output script to '/opt/startup/startup.sh'
2023-04-26T06:17:54.069047881Z Running #!/bin/sh


2023-04-26T06:18:06.365504769Z SyntaxError: Unexpected token ?
2023-04-26T06:18:06.365508370Z     at new Script (vm.js:79:7)
2023-04-26T06:18:06.365511870Z     at createScript (vm.js:251:10)
2023-04-26T06:18:06.365515370Z     at Object.runInThisContext (vm.js:303:10)
2023-04-26T06:18:06.365518770Z     at Module._compile (internal/modules/cjs/loader.js:657:28)
2023-04-26T06:18:06.365525270Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
2023-04-26T06:18:06.365528770Z     at Module.load (internal/modules/cjs/loader.js:599:32)
2023-04-26T06:18:06.365537970Z     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
2023-04-26T06:18:06.365541970Z     at Function.Module._load (internal/modules/cjs/loader.js:530:3)
2023-04-26T06:18:06.365545570Z     at Module.require (internal/modules/cjs/loader.js:637:17)
2023-04-26T06:18:06.365549270Z     at require (internal/modules/cjs/helpers.js:20:18)
2023-04-26T06:18:06.444569382Z npm info lifecycle e******@0.0.0~start: Failed to exec start script

What I find extremely strange, is that before a few days ago, it worked fine, but I've been trying to use an SMS messaging API, and it seems that the mere existence of the 'require' function in my code is what's causing this. In an attempt to debug, I went back and undid my changes until my API was able to start, and I've found that when I remove the directive, my API is able to start, even if I still have the SDK installed in my app. The only things I could think of doing was to update the version of Node that Azure uses when deploying my app, and fixing all the vulnerabilities NPM informed me of in my app, but neither of those worked. Regarding the error message, I understand what "Unexpected token" normally denotes, but for this, I do not know where to look, or if that's something I can fix manually. Any information on steps I can take to solve this or where I can look to find the source of this issue would be greatly appreciated. Thank you

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,961 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. RevelinoB 3,675 Reputation points
    2023-04-26T07:12:08.61+00:00

    Hello Ford! It looks like you're encountering an error with your Azure App Services hosting. Specifically, you're receiving an error message that indicates your container is failing to respond to HTTP pings on port 8080, and your container crash logs show a syntax error related to an unexpected token. Additionally, your app logs suggest that a missing build manifest file may be causing an issue. It's possible that your recent changes, particularly the use of the 'require' function in your code, may have caused the issue. You mentioned that removing the directive allows your API to start, even if the SDK is still installed. This could indicate that the 'require' function is causing a conflict with the SDK or with other code in your app. To resolve this issue, you may want to try a few things. First, you could review your recent changes to see if you can identify any issues that may be causing conflicts. You could also try updating the version of Node that Azure uses when deploying your app, as well as fixing any vulnerabilities that NPM has flagged in your app. I hope this helps?


  2. RevelinoB 3,675 Reputation points
    2023-04-26T13:18:23.8033333+00:00

    Hi Ford, I think it could be beneficial to build the manifest file oryx-manifest.toml this is used by Azure App Service to determine the platform and runtime configuration for your application. It's possible that the absence of this file is causing issues with your application's deployment. I would suggest creating a oryx-manifest.toml file in the root directory of your application and specifying the runtime and platform details as appropriate for your application. You can find more information about creating and using the manifest file in the Azure documentation here. Once you have created the manifest file, you can include it in your deployment package and deploy it to Azure App Service. This should help Azure App Service to correctly identify the runtime and platform configuration for your application, which may resolve some of the issues you are experiencing. I hope this would help? If you have any questions please let me know.

    0 comments No comments

  3. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-04-27T19:31:00.2+00:00

    Ford B ,  I understand you have tried multiple things to isolate the issue. Just adding to RevelinoB suggestions.

    --Kindly check if you are defining a Nodejs version in the portal with this setting (under app settings): WEBSITE_NODE_DEFAULT_VERSION=nodejsversion

    --The error could be due to installed modules, please refer this article. You may consider to upgrade your application to use Node.js 18 version.

    Node.js xx applications failing by Optional chaining (older article, apply it for latest version)

    --Review the port value and startup command for Node app, as outlined in this article

    Troubleshooting ‘Container didnt respond to HTTP pings on port, failing site start’

    For more info, please check these docs:

    Kindly let us know how it goes, I'll follow-up with you further.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.