Receiving [ERR_REQUIRE_ESM] and azure500.1002 - Internal Server Error when opening Node.JS App.

Jonah Foster 1 Reputation point
2023-12-21T14:31:16.0633333+00:00

I have an Azure App Service set up for the backend of my React/Node.JS app. It is an Express server that includes routes to get data from my database on Azure. When I go to the browser and check the log stream I see [ERR_REQUIRE_ESM] and azure500.1002 - Internal Server Error are the errors that appear. On the browser itself I just see The page cannot be displayed because an internal server error has occurred.

Not really expecting to see anything of course since it is the backend, but I'm not sure what has gone wrong with my implementation. I have a web.config file, node.mjs, package.json, and a Github Actions workflow that seems properly configured. I tried to switch everything from ES6 to CommonJS but it results in Github Actions not being able to properly install Node for some reason. Any help would be appreciated, and feel free to request more information I'm not sure what to provide!

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

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2023-12-27T10:54:52.2533333+00:00

    @Jonah Foster Thanks for reaching here!

    To see the error message, you need to enable the application level log for node.js.

    Here is a guide on how to deploy a nodejs app to azure for your reference.

    Further for Troubleshooting you may follow below steps-

    • Access the log stream.
    • Test the app locally in production mode. App Service runs your Node.js apps in production mode, so you need to make sure that your project works as expected in production mode locally. For example:
      • Depending on your package.json, different packages may be installed for production mode (dependencies vs. devDependencies).
      • Certain web frameworks may deploy static files differently in production mode.
      • Certain web frameworks may use custom startup scripts when running in production mode.
    • Run your app in App Service in development mode. For example, in MEAN.js, you can set your app to development mode in runtime by setting the NODE_ENV app setting.

    Please let us know, if further assistance required here.

    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.