I have deployed my nodeJs RESTFull API with MySQL, on azure using Dropbox. On console i have seen logs that application started listing and database is connected. thus lines are
I had a similar issue with my Azure web app using NextJS and Express server. Even though, I was using process.env.PORT
in my code, I was still getting above mentioned error. After spending some time I found that the issue was on this line in server.js:
Wrong
const port = parseInt(process.env.PORT, 10) || 3000
Correct
const port = process.env.PORT || 3000
I am pasting my answer for anyone else facing the same issue when using custom server for NextJS. The point to remember is that Azure uses pipe like \\.\pipe\xx-xx-xx-xx
instead of port number.
2 things:
You should use process.env.PORT
for handling the named pipe port in Azure App Service. See Listen additional port Microsoft Azure Nodejs.
If #1 didn't solve your problem, you'll need to enable logging of stdout and stderr for further troubleshooting. See How to enable BLOB-logging for a Node.js Api App on Azure?