Application Error message when browsing Azure deployed web app - azure

I created a simple web app (serverless) and deployed the web app using Azure App Service VS Code extension. I chose Linus + Node LTS environment. I configured deployment source to a local Git repo (also tried remote GitHub repo) and deployed. The deployment shows successful message. But when I browse the site, it throws a message (after 3-4 mins) that there was an ":( Application error". The admin diagnostics link doesn't show any error. Any reason why this could be happening?
Where can I find error details?
The web app compiles/runs fine on the local host.

Enable Log Streamming, then you'll be able to figure out what the problem is:
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs
As another option, you can also instrument your application with Application Insights:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/nodejs

On Azure WebApps, the container/application must respond to HTTP pings on the required port (check docker run command in the Log Stream) within 230 seconds, by default.
For a NodeJS app, you'd need to start the server in the following way:
const port = process.env.PORT || 1337;
server.listen(port);
Try deploying the sample available here:
https://github.com/Azure-Samples/nodejs-docs-hello-world
If that does not help, enable App Service Logs and check for any errors in the Log Stream.
I had created a NodeJS app which integrates with Application Insights some days back:
https://github.com/gkgaurav31/nodejs-application-insights-test-app

change your listen port either 8080 or 1337

By default, NodeJS webapp runs on port 8080. You are either running your port on some other port (Ex: 3000 or so) and then deploying it to webapp. Try changing your port in NodeJS app to 8080 and it should work.

Related

Azure App Service - how to configure port? [duplicate]

This question already has an answer here:
socket.io client not connected to azure server created in socket.io
(1 answer)
Closed 18 days ago.
When I deploy example Spring Boot app to Azure App Service with Maven (just like in documentation), it works correctly regardles of server.port value in application.properties file. The App Service just "knows" what is the target port.
When I deploy other app, which is not based on Spring Boot and instead it is based on Tomcat Embedded and has port value hardcoded in its source code, the App Service does not work correctly. How can I "tell" the App Service what is the port that my app listens on?
App Service always listens on port 80/443. You can map to the port your app listening on setting the WEBSITES_PORT application setting to your app port number.

Application deployed in Azure VM

I have a react application deployed using an Azure virtual machine. To access the app I need to use configured DNS, for example, "http://XYZ.eastasia.cloudapp.azure.com:3000". However, I don't want to include the port num in the URL. How can I port forward in azure so that only by typing 'http://XYZ.eastasia.cloudapp.azure.com' should be enough to access the application?
If you want to users access your app by URL: http://XYZ.eastasia.cloudapp.azure.com, you should run your react app on 80 port. Refer to this post to specify a port to run react app.

How to view console.log() output in Azure app service app

I have a react app running fine on localhost:3000. When I deploy on Azure app service build and start up succeed but the error is that the app is not responding on 8080. Being able to view the output of console.log would really be a help to seeing whether the app is starting on the right port or not! I've configured app service logging but no log messages. I think both std.err and std.out should end up in the docker logs that I can view from VS Code. Is there something I could have missed?
In azure webapp, the port only supports 80 and 443, usually we define process.env.PORT || '3000' in the code like this.
It is recommended to use continuous deployment to make the deployment process more convenient.
Test Sample code. (offical sample code)
I modify it for test.
Deploy by git.
After deployed.
Setting App Service logs.
Check Log stream, you will find the content of console.log.

Nodejs Loopback how to access api end points on live server?

I'm trying to deploy a Loopback project to live server, all works well on local. On server, after running node ., I get the console log of:
Web server listening at: http://domainname:3000
Browse your REST API at http://domainname:3000/explorer
So it looks like the server is running.
Problem is that I get no response from the server. Neither from domain:3000 or /explorer or any endpoint I created.
Does anyone know what might be the issue?
Thank you very much
I had a similar problem when I was trying to deploy my code. Some of the possible solutions to the problem depending on where and how you are deploying it-
Check if your security group allows connections on port 3000. AWS EC2 by default closes all ports except port 80. You might have to add an exception to your security group and allow port 3000 to be accessed from everywhere.
If you are using a container, check if your container has the ports open and if the container port is accessible by the hardware hosting the container. On Azure, I faced this problem as Azure Web App Container Service by default only listens to port 80 and 8080. So I had to modify my code such that it can use the default NODE_ENV.PORT or 8080.

Azure web roles locally start on the wrong port

I have a simple web application which we recently moved over to Azure. Running in the local Azure emulator and on IIS Express, in the WebRole I have set it to run on https://localhost:12345, but when I run the project it comes up on http://localhost:63855/. Completely different port and a distinct lack of HTTPS.
Thank you in advanced,
Andrew

Resources