Git Product home page Git Product logo

Comments (4)

bradygmsft avatar bradygmsft commented on July 20, 2024 2

oh gracious. :) i could provide a more descriptive... description...

from azure-functions-nodejs-worker.

burkeholland avatar burkeholland commented on July 20, 2024 2

Some people will say nvm. But n is 2 letters shorter. That's called "productivity".

from azure-functions-nodejs-worker.

bradygmsft avatar bradygmsft commented on July 20, 2024 1

Repro steps. Make sure you have the Azure Functions tools installed. CCing @fiveisprime FYI on the issue on that side. Also cc'ing @SyntaxC4 on the docs side, as this might be beneficial information to docs readers.

  1. mkdir functionDebugTest
  2. cd functionDebugTest
  3. code .
  4. create a new javascript functions project using the functions explorer button
  5. add an httptrigger function to the project using the functions explorer button
  6. put a breakpoint on the first line of "real code" in the resulting index.js file.
  7. "hit f5" to debug the function

At this point, one would think the debugger just goes into action, attaches, and life is grand. This, however, is not the case with Node.js v9.

In the terminal window there are a few errors that appear. At first it looks like func is going to work fine, but then red text appears informing me:

Http Functions:
HttpTriggerJS: http://localhost:7071/api/HttpTriggerJS

[2/16/18 9:37:07 PM] A ScriptHost error has occurred
[2/16/18 9:37:07 PM] Worker process with pid 21160 exited with code 1.

If I let func continue to run and hit the URL, I get a huge swath of error text:

[2/16/18 9:43:19 PM] Function started (Id=2413fa60-6b53-4bd5-b5a8-75366c5df475)
[2/16/18 9:43:19 PM] Executing 'Functions.HttpTriggerJS' (Reason='This function was programmatically called via the host APIs.', Id=2413fa60-6b53-4bd5-b5a8-75366c5df475)
[2/16/18 9:43:19 PM] A ScriptHost error has occurred
[2/16/18 9:43:19 PM] Exception while executing function: Functions.HttpTriggerJS. System.Private.CoreLib: One or moreerrors occurred. (Worker process with pid 21874 exited with code 1) (Worker process with pid 21877 exited with code 1) (Worker process with pid 21878 exited with code 1). Worker process with pid 21874 exited with code 1.
[2/16/18 9:43:19 PM] Exception while executing function: Functions.HttpTriggerJS. System.Private.CoreLib: One or moreerrors occurred. (Worker process with pid 21874 exited with code 1) (Worker process with pid 21877 exited with code 1) (Worker process with pid 21878 exited with code 1). Worker process with pid 21874 exited with code 1.
[2/16/18 9:43:19 PM]
[2/16/18 9:43:19 PM] Exception while executing function: Functions.HttpTriggerJS
[2/16/18 9:43:19 PM] Exception while executing function: Functions.HttpTriggerJS. System.Private.CoreLib: One or moreerrors occurred. (Worker process with pid 21874 exited with code 1) (Worker process with pid 21877 exited with code 1) (Worker process with pid 21878 exited with code 1). Worker process with pid 21874 exited with code 1.
[2/16/18 9:43:19 PM] Function completed (Failure, Id=2413fa60-6b53-4bd5-b5a8-75366c5df475, Duration=210ms)
[2/16/18 9:43:19 PM]
[2/16/18 9:43:19 PM] Executed 'Functions.HttpTriggerJS' (Failed, Id=2413fa60-6b53-4bd5-b5a8-75366c5df475)
[2/16/18 9:43:19 PM] System.Private.CoreLib: Exception while executing function: Functions.HttpTriggerJS. System.Private.CoreLib: One or more errors occurred. (Worker process with pid 21874 exited with code 1) (Worker process with pid 21877 exited with code 1) (Worker process with pid 21878 exited with code 1). Worker process with pid 21874 exited with code 1.
[2/16/18 9:43:19 PM]   Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '2413fa60-6b53-4bd5-b5a8-75366c5df475'
[2/16/18 9:43:19 PM] System.Private.CoreLib: Exception while executing function: Functions.HttpTriggerJS. System.Private.CoreLib: One or more errors occurred. (Worker process with pid 21874 exited with code 1) (Worker process with pid 21877 exited with code 1) (Worker process with pid 21878 exited with code 1). Worker process with pid 21874 exited with code 1.

How I worked around it

With the help of @burkeholland I learned of the glory of the n package, which I used to switch to the LTS version of Node.js using the command

n lts

Now, when I run the debugger, the output is as I'd hoped/expected, and HTTP requests to the trigger work fine.

info: Worker.Node.be02b7f3-51db-4e0d-90eb-a0003a6d555e[0]
      Worker be02b7f3-51db-4e0d-90eb-a0003a6d555e connecting on 127.0.0.1:49725
info: Worker.Node.be02b7f3-51db-4e0d-90eb-a0003a6d555e[0]
      Debugger attached.
Listening on http://localhost:7071/
Hit CTRL-C to exit...

Http Functions:

        HttpTriggerJS: http://localhost:7071/api/HttpTriggerJS

Suggestion

I think it'd be good if func could detect the Node.js version and if it's an unsupported one (or "just 9"), halt execution and give the user a URL to learn more.

from azure-functions-nodejs-worker.

mhoeger avatar mhoeger commented on July 20, 2024

Note: The error message is improved but still buried in logs (especially for those looking at the Portal). This work item tracks increasing visibility: Azure/azure-functions-host#2299

from azure-functions-nodejs-worker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.