Node Js RestFull API on Azure,Returns HTTP Error 500.1001 - Internal Server Error

前端 未结 2 1416
走了就别回头了
走了就别回头了 2021-01-27 07:43

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

相关标签:
2条回答
  • 2021-01-27 08:32

    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.

    0 讨论(0)
  • 2021-01-27 08:34

    2 things:

    1. You should use process.env.PORT for handling the named pipe port in Azure App Service. See Listen additional port Microsoft Azure Nodejs.

    2. 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?

    0 讨论(0)
提交回复
热议问题