Azure / azure-webjobs-sdk

Azure WebJobs SDK
MIT License
738 stars 358 forks source link

Function apps breaks after upgrading to Function Runtime Version: 2.0.12050.0 #1886

Open reggiepangilinan-s5 opened 6 years ago

reggiepangilinan-s5 commented 6 years ago

Azure Functions Core Tools (2.0.1-beta.37) Function Runtime Version: 2.0.12050.0

I have different function triggers in one function app

Tried everything as advised in this thread #129

So i tried creating a clean function app project from scratch just to debug the issue.

Repro steps

Provide the steps required to reproduce the problem

  1. Initialised a new function project. Added all functions through the terminal using func new Just followed all VSCode recommendations and did a dotnet restore

Here is the project file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <AzureFunctionsVersion/>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.0-beta8"/>
    <PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="3.0.0-beta8"/>
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.19"/>
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>
  1. Hit F5 to run function app

Expected behavior

I Just expect it to work.

Actual behavior

This is the output from the local emulator

Azure Functions Core Tools (2.0.1-beta.37)
Function Runtime Version: 2.0.12050.0
Skipping 'AzureWebJobsDashboard' from local settings as it's already defined in current environment variables.
: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using '/Users/reggiepangilinan/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
info: Host.Startup[0]
      Reading host configuration file '/Users/reggiepangilinan/Projects/TestAzureFuncV2Console2/bin/Debug/netstandard2.0/host.json'
info: Host.Startup[0]
      Host configuration file read:
      {
        "version": "2.0"
      }
[06/09/2018 01:54:27] Initializing Host.
[06/09/2018 01:54:27] Host initialization: ConsecutiveErrors=0, StartupCount=1
[06/09/2018 01:54:27] Starting JobHost
[06/09/2018 01:54:27] Starting Host (HostId=reggiesmacbookpro-131183640, InstanceId=be7af9b0-03aa-4f8d-a5bb-adee4f71e2bc, Version=2.0.12050.0, ProcessId=66464, AppDomainId=1, Debug=False, FunctionsExtensionVersion=)
[06/09/2018 01:54:27] Generating 3 job function(s)
[06/09/2018 01:54:28] Found the following functions:
[06/09/2018 01:54:28] TestAzureFuncV2Console2.ServiceBusTopicTest.Run
[06/09/2018 01:54:28] TestAzureFuncV2Console2.HttpTriggerTest.Run
[06/09/2018 01:54:28] TestAzureFuncV2Console2.BlobTrigger.Run
[06/09/2018 01:54:28]
[06/09/2018 01:54:28] Host initialized (315ms)
[06/09/2018 01:54:28] A ScriptHost error has occurred
[06/09/2018 01:54:28] System.Private.Uri: Value cannot be null.
[06/09/2018 01:54:28] Parameter name: uriString.
[06/09/2018 01:54:28] Stopping JobHost
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/reggiepangilinan/Projects/TestAzureFuncV2Console2/bin/Debug/netstandard2.0
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
[06/09/2018 01:54:28] Stopping JobHost
info: Host.General[0]
      Stopping host...
info: Host.General[0]
      Host shutdown completed.
The terminal process terminated with exit code: 1

Known workarounds

Cant get it working.

Related information

Provide any related information

NathanYukai commented 5 years ago

Hi @reggiepangilinan-s5 , did you manage to solve this? I'm getting the same error with function run time 2.0.12438.0 core tool 2.7.1158

NathanYukai commented 5 years ago

I found out that I used the wrong connection string, which does not contain an "Endpoint" value, and caused this error.