Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run a local function with build from source on macOS #697

Open
TylerLeonhardt opened this issue Sep 6, 2018 · 2 comments
Open

Comments

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Sep 6, 2018

On a mac with macOS 10.13 I am unable to follow the CONTRIBUTING.md guide to get a local build working.

Steps:

  • Clone the repo
  • dotnet restore
  • cd src/Azure.Functions.Cli; dotnet build
  • mkdir /tmp/testFunctions; cd /tmp/testFunctions
  • dotnet run --project /path/to/azure-functions-core-tools/src/Azure.Functions.Cli init --worker-runtime node
  • dotnet run --project /path/to/azure-functions-core-tools/src/Azure.Functions.Cli new -l js -t HttpTrigger -n TestHttpTrigger

NOTE: everything works fine... until

  • dotnet run --project /Users/tyler/Code/CSharp/azure-functions-core-tools/src/Azure.Functions.Cli start

which gives me:


                  %%%%%%
                 %%%%%%
            @   %%%%%%    @
          @@   %%%%%%      @@
       @@@    %%%%%%%%%%%    @@@
     @@      %%%%%%%%%%        @@
       @@         %%%%       @@
         @@      %%%       @@
           @@    %%      @@
                %%
                %

Azure Functions Core Tools (2.0.1-beta.38)
Function Runtime Version: 2.0.12050.0
Skipping 'AzureWebJobsStorage' from local settings as it's already defined in current environment variables.
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using '/Users/tyler/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
info: Host.Startup[0]
      Reading host configuration file '/Users/tyler/Code/JavaScript/testFunctions/host.json'
info: Host.Startup[0]
      Host configuration file read:
      {
        "version": "2.0"
      }
[9/6/18 3:27:30 AM] Initializing Host.
[9/6/18 3:27:30 AM] Host initialization: ConsecutiveErrors=0, StartupCount=1
[9/6/18 3:27:30 AM] A ScriptHost error has occurred
[9/6/18 3:27:30 AM] System.Private.CoreLib: Exception has been thrown by the target of an invocation. System.IO.FileSystem: Could not find a part of the path '/Users/tyler/.nuget/packages/microsoft.azure.webjobs.script/2.0.0-beta2-12050/lib/netstandard2.0/workers'.
Listening on http://0.0.0.0:7071/
Hit CTRL-C to exit...
Container is disposed and should not be used: Container is disposed.
You may include Dispose stack-trace into the message via:
container.With(rules => rules.WithCaptureContainerDisposeStackTrace())
Application is shutting down...
info: Host.General[0]
      Initialization cancellation requested by runtime.
crit: Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor[9]
      An error occurred starting the application
System.AggregateException: One or more errors occurred. (The operation was canceled.) ---> System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.<>c__DisplayClass21_0.<StartHostAsync>b__1(Task t) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 138
   at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.StartHostAsync(CancellationToken cancellationToken, Int32 attemptCount, Boolean skipHostJsonConfiguration) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 135
   at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.StartAsync(CancellationToken cancellationToken) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 62
   at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.ExecuteAsync(Func`2 callback)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.ExecuteAsync(Func`2 callback)
   at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.StartAsync(CancellationToken token)
---> (Inner Exception #0) System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.<>c__DisplayClass21_0.<StartHostAsync>b__1(Task t) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 138
   at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.StartHostAsync(CancellationToken cancellationToken, Int32 attemptCount, Boolean skipHostJsonConfiguration) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 135
   at Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.StartAsync(CancellationToken cancellationToken) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs:line 62
   at Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor.ExecuteAsync(Func`2 callback)<---

Hosting environment: Production
Content root path: /Users/tyler/Code/JavaScript/testFunctions
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
info: Host.General[0]
      Stopping host...
info: Host.General[0]
      Host shutdown completed.

Note the:

[9/6/18 3:27:30 AM] System.Private.CoreLib: Exception has been thrown by the target of an invocation. System.IO.FileSystem: Could not find a part of the path '/Users/tyler/.nuget/packages/microsoft.azure.webjobs.script/2.0.0-beta2-12050/lib/netstandard2.0/workers'.

I inspected this package to find:

PS /Users/tyler/Code/JavaScript/testFunctions> ls /Users/tyler/.nuget/packages/microsoft.azure.webjobs.script/2.0.0-beta2-12050/
content                                                        lib                                                            microsoft.azure.webjobs.script.2.0.0-beta2-12050.nupkg.sha512
contentFiles                                                   microsoft.azure.webjobs.script.2.0.0-beta2-12050.nupkg         microsoft.azure.webjobs.script.nuspec
PS /Users/tyler/Code/JavaScript/testFunctions> ls /Users/tyler/.nuget/packages/microsoft.azure.webjobs.script/2.0.0-beta2-12050/lib/
netstandard2.0
PS /Users/tyler/Code/JavaScript/testFunctions> ls /Users/tyler/.nuget/packages/microsoft.azure.webjobs.script/2.0.0-beta2-12050/lib/netstandard2.0/
Microsoft.Azure.WebJobs.Script.dll
PS /Users/tyler/Code/JavaScript/testFunctions> ls /Users/tyler/.nuget/packages/microsoft.azure.webjobs.script/2.0.0-beta2-12050/content
Microsoft.FSharp.NetSdk.props		Microsoft.FSharp.NetSdk.targets		Microsoft.FSharp.Targets		Microsoft.Portable.FSharp.Targets	default.win32manifest

No workers folder... not sure if that's expected.

Any thoughts?

@TylerLeonhardt TylerLeonhardt changed the title Unable to run a local function with build from source Unable to run a local function with build from source on macOS Sep 6, 2018
@ahmelsayed
Copy link
Contributor

a workaround is to use publish, something like:

dotnet publish src/Azure.Functions.Cli/Azure.Functions.Cli.csproj --runtime osx-x64 --output /tmp/cli 

# then do
/tmp/cli/func start 

@hannesne
Copy link

I encountered this issue on Windows also. I got it going by creating a workers folder in %userprofile%.nuget\packages\microsoft.azure.webjobs.script\2.0.12246\lib\netstandard2.0\workers
In this folder, I then copied the content for a nodejs worker (I was trying to run a node function). I created a folder called Microsoft.Azure.Functions.NodeJsWorker and copied the content of the pkg folder when you run the package script in the nodejsworker repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants