Azure function app - Internal server error 500

TickingClock 26 Reputation points
2020-08-11T13:13:38.68+00:00

Hello,

I have created a nestjs application and tried hosting using azure functions core tools from terminal. I can see, The deployment is successful.
but the apis are not working, it always throw 500 Internal server error. i don't find enough information on LogStream.

The local deployment, worked very well though.

I have followed this article to deploy : https://trilon.io/blog/deploy-nestjs-azure-functions#

Please kindly help me resolve this issue.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,073 questions
{count} vote

Accepted answer
  1. JayaC-MSFT 5,531 Reputation points
    2020-08-12T17:08:17.523+00:00

    @TickingClock I have taken it up offline and figured that you were encountering exception "Exception: Worker was unable to load function main: 'Error: \?\D:\home\site\wwwroot\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node is not a valid Win32 application.
    \?\D:\home\site\wwwroot\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node'

    That is because you were using 'bcrypt' module and bcrypt is a native package, while bcryptjs (this package) is pure JS and works in Azure environment. Once you started using 'bcryptjs' module instead of 'bcrypt' module application started working fine. you may refer to : https://github.com/dcodeIO/bcrypt.js/issues/112

    Also, you were unable to see the exception from the portal. In that case you can:

    1. Go to the "Application Insight" associated with the Function app. Then go to --> logs--> exceptions

    17219-image.png

    1. You can go to the function app. Go to Advanced tool( Kudu) --> Debug Console --> LogFiles--> Application ( D:\home\LogFiles\Application\Functions) --> Select folders accordingly --> log file.

    Please let me know if you have any concern in this regard.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.