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

前端 未结 2 1417
走了就别回头了
走了就别回头了 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.

提交回复
热议问题