'Cannot deploy a react app to azure app services

I’m trying to deploy a basic react app to Azure app services, but I cannot get it to work.

The app itself is the initial app created following npx create react app my-app command. I want to get this one working first before trying to deploy my actual react app.

The Azure App Service is a Linux setup, using node 16. I’ve added “pm2 serve /home/site/wwwroot --no-daemon” as the startup command. I’ve also added PORT 3000 and WEBSITE_PORT 3000 in app settings.

Lastly I’ve added a web.config file to the react app itself.

Nothing I do seems to work though as it is not loading at all. I just get ‘application error’ if I try to open the app.

The only two errors i can see in the logs are:

“…didn't respond to HTTP pings on port: 3000” and “… did not start within expected time limit”

My deployment is set as continuous via git hub, though as this is building without an issue I think the problem must be something in the Azure App Service settings but I’m lost as to what.

Does anyone have any ideas to fix this?



Solution 1:[1]

It could be that there is no access to port 3000 in the app service.

It depends on how you have set it up what needs to be fixed. It could be the network settings on the app service. If your app service is on a VNET then it could be the settings on the VNET that need to be updated.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shiraz Bhaiji