Azure-functions-host: CLI: Running new node.js function fails...

Created on 26 Oct 2016  Â·  15Comments  Â·  Source: Azure/azure-functions-host

Please provide a succinct description of the issue.

Repro steps

Provide the steps required to reproduce the problem.

I have a video of the behavior here: https://1drv.ms/v/s!Al5K6Hl-Z2ggovkBH9Xy6sM4TpBgCQ

  1. Create a new folder for your function app
  2. Run func init
  3. Run func new and select:

    • List templates by language

    • JavaScript

    • TimerTrigger-NodeJS

    • name the new function timerTriggerJs

  4. fun func run .\timerTriggerJs --cli-dev
  5. When prompted, type "yes" to enable the launching of the web server.
  6. A window flashes briefly with the error message Unable to parse option verb
  7. An exception is reported at the command line:
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:7071
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at WebJobs.Script.Cli.Verbs.RunVerb.<RunAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at NCli.ConsoleApp.<RunAsync>d__5`1.MoveNext()

Expected behavior

It's never worked for me, but I assume it is supposed to launch a server that runs the function.

Actual behavior

Window flashes with Unable to parse option verb message then closes and the exception shown above is returned.

Known workarounds

none.

Related information

I have a video of the behavior here: https://1drv.ms/v/s!Al5K6Hl-Z2ggovkBH9Xy6sM4TpBgCQ

Using Node.js

cli-dependency

All 15 comments

@BretStateham Thanks for reporting the issue. What version of the CLI did you install?

I just got this same error with a C# function. I'm using CLI version 0.1.

I installed whatever npm pushed as the version (I didn't request a specific version). However, if I do an

npm list -g azure-functions-cli

It reports my version as:

[email protected]

I can confirm this - I get the exact same errors.

@lindydonna: Maybe it is a good idea to switch to the old how-to article until this is solved:
https://azure.microsoft.com/en-us/documentation/articles/functions-run-local/
...I can find the old version via search engine cache (bing, google) only.

@mikezks Sorry you're running into this--we're fixing.

You can find the previous article here: https://github.com/Azure/azure-content/blob/8c12413da107d96b541f4fcd0524d2da983b43f2/articles/azure-functions/functions-run-local.md. Thanks for the feedback, if the fix takes too long I'll see about reverting to the old version.

@lindydonna: Absolutely no problem - thanks to all of you for the amazing work on Azure Functions! :)

Your link shows a 404.

@mikezks Whoops, left off the .md. Edited above.

@ahmelsayed I can repro with the same stack trace as @BretStateham

When I launch the host manually with "func host" and then do "func run" from a different console window, I get the following:

Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '12acdbab-604f-4845-96e4-d4b1180c0d53'
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.HttpTriggerNode ---> System.TypeLoadException: Could not load type '
Microsoft.Azure.WebJobs.Binder' from assembly 'Microsoft.Azure.WebJobs.Host, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
   at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.<Invoke>d__23.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters)
   at Host.Functions.HttpTriggerNode(HttpRequestMessage req, TraceWriter _log, IBinder _binder, ExecutionContext _context)
   at lambda_method(Closure , Functions , Object[] )
   at Microsoft.Azure.WebJobs.Host.Executors.TaskMethodInvoker`1.InvokeAsync(TReflected instance, Object[] arguments)
   at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.<InvokeAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---

I got it running by manually starting the server on port 7071:
func host -p 7071

and then in a separate window run:
func run <functionname>

Seems related to #840

@ahmelsayed Please verify the fix

npm i -g [email protected]​​​

Please reopen - it still does not work for me.

Install of npm i -g [email protected]​​​ works, but func shows Azure Functions Cli (0.2.10.0)

func run func1 does not work: Error: unknown argument run, but func function run func1 works (-> maybe wrong documentation?), but causes the same errors as reported above.​​​

@lindydonna, I have an issue (dead link) for the Azure Bot Service docs and can't find https://github.com/Azure/azure-content/ anymore. Could you please advice where I can report this? Thx!

@mikezks I just ran into this same issue and it was really becoming a showstopper for me. Turns out you need to run your terminal /command line as admin (at least on Windows) cc @ahmelsayed @lindydonna

This issue was moved to Azure/azure-functions-cli#9

Was this page helpful?
0 / 5 - 0 ratings

Related issues

silencev picture silencev  Â·  3Comments

rati3l picture rati3l  Â·  3Comments

svickers picture svickers  Â·  3Comments

ahmelsayed picture ahmelsayed  Â·  4Comments

silencev picture silencev  Â·  4Comments