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

Azure Functions V2 3.0.0-beta5 startup errors with service bus when bindings are not correct #2786

Open
grahambunce opened this issue May 3, 2018 · 8 comments

Comments

@grahambunce
Copy link

grahambunce commented May 3, 2018

Investigative information

Local development environment
Function App version: 3.0.0-beta5
.NET 4.7.1 needed to be installed to run the app

Repro steps

Provide the steps required to reproduce the problem:

  1. Create a clean .NET Functions C# console app (.NET Standard 2) (NB: Microsoft.NET.Sdk.Functions version is 1.0.13)
  2. Add Microsoft.Azure.WebJobs.ServiceBus (3.0.0-beta5)
  3. Change triggers to Service Bus Triggers
  4. Add additional config information - ensure the endpoint is incorrect
  5. Run app

Expected behavior

App to start without errors but to warn of missing bindings (i.e. topic name, subscription)

Actual behavior

Error messages in log:

  • Unable to configure java worker. Could not find JAVA_HOME app setting
  • Exception during runtime resolution of assembly 'Microsoft.Azure.Amqp.resources Version=2.1.0.0

No reference to potential misconfiguration - exception trace is therefore misleading

Java home covered by #2765 [Expected release date?]

Version of Microsoft.Azure.Amqp brought into solution file by Microsoft.Azure.ServiceBus is 2.1.1

Attempted redirect:
"BindingRedirects": "[ { "ShortName": "Microsoft.Azure.Amqp", "RedirectToVersion": "2.1.2", "PublicKeyToken": "31bf3856ad364e35" }]"

No impact

[03/05/2018 09:15:50] Unable to configure java worker. Could not find JAVA_HOME app setting.
[03/05/2018 09:15:50]
[03/05/2018 09:15:50] Could not configure language worker Java.
[03/05/2018 09:15:50]
[03/05/2018 09:15:50] Loaded custom extension: ServiceBusExtensionConfig from 'referenced by: Method='MSS.PatronAccount.Host.CirculationEvent.Run', Parameter='myQueueItem'.'
[03/05/2018 09:15:51] Generating 1 job function(s)
[03/05/2018 09:15:51] Found the following functions:
[03/05/2018 09:15:51] MSS.PatronAccount.Host.CirculationEvent.Run
[03/05/2018 09:15:51]
[03/05/2018 09:15:51] Host initialized (1091ms)
Listening on http://localhost:7071/
Hit CTRL-C to exit...
[03/05/2018 09:15:53] Host started (2939ms)
[03/05/2018 09:15:53] Job host started
[03/05/2018 09:15:54] Host lock lease acquired by instance ID '0000000000000000000000009462CA7D'.
[03/05/2018 09:15:54] Exception during runtime resolution of assembly 'Microsoft.Azure.Amqp.resources, Version=2.1.0.0, Culture=en-GB, PublicKeyToken=31bf3856ad364e35': 'System.InvalidCastException: [A]System.AppDomain cannot be cast to [B]System.AppDomain. Type A originates from 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Private.CoreLib.dll'. Type B originates from 'System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Runtime.Extensions.dll'.
[03/05/2018 09:15:54] at Microsoft.Azure.WebJobs.Script.Description.FunctionAssemblyLoader.ResolveAssembly(Object sender, ResolveEventArgs args) in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\FunctionAssemblyLoader.cs:line 66'
[03/05/2018 09:15:54] Unable to find assembly 'Microsoft.Azure.Amqp.resources, Version=2.1.0.0, Culture=en-GB, PublicKeyToken=31bf3856ad364e35'. Are you missing a private assembly file?
[03/05/2018 09:15:54] Exception during runtime resolution of assembly 'Microsoft.Azure.Amqp.resources, Version=2.1.0.0, Culture=en, PublicKeyToken=31bf3856ad364e35': 'System.InvalidCastException: [A]System.AppDomain cannot be cast to [B]System.AppDomain. Type A originates from 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Private.CoreLib.dll'. Type B originates from 'System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Runtime.Extensions.dll'.
[03/05/2018 09:15:54] at Microsoft.Azure.WebJobs.Script.Description.FunctionAssemblyLoader.ResolveAssembly(Object sender, ResolveEventArgs args) in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\FunctionAssemblyLoader.cs:line 66'
[03/05/2018 09:15:54] Unable to find assembly 'Microsoft.Azure.Amqp.resources, Version=2.1.0.0, Culture=en, PublicKeyToken=31bf3856ad364e35'. Are you missing a private assembly file?

Related information

Source
    public static class CirculationEvent
    {
        [FunctionName("CirculationEvent")]
        public static void Run([ServiceBusTrigger("circulation", "account", Connection = "microsoft.servicebus.connectionstring")]string myQueueItem, TraceWriter log)
        {
            log.Info($"C# Queue trigger function processed: {myQueueItem}");
        }
    }
@grahambunce grahambunce changed the title Azure Functions V2 3.0.0-beta5 startup errors with service bus Azure Functions V2 3.0.0-beta5 startup errors with service bus when bindings are not correct May 3, 2018
@pragnagopa pragnagopa added this to the Active Questions milestone May 7, 2018
@pragnagopa
Copy link
Member

Fix for #2765 will be part of next release. Approximate ETA within in two weeks.

cc: @fabiocav for assembly loading issue.
@fabiocav - would the latest changes resolve assembly loading issue here?

@fabiocav
Copy link
Member

fabiocav commented May 7, 2018

The latest changes (yet to be released with updated tooling) will help with these issues.

@grahamehorner
Copy link

@fabiocav is it possible to get everything from the repo/build and deploy to a instance of VS2017 to allow us to continue development, until such time these changes are made public? or is there a nightly build myget feed available

@Bubeee
Copy link

Bubeee commented May 10, 2018

Hello.

Have the same issue. Thought, it was caused by Microsoft.Azure.KeyVault package installing. But it worked fine last week (have a couple of ServiceBusTrigger functions).

image

My nuget dependencies:

image

PS. Using the latest tools and VS 2017 updates.

Regards, Uladzimir.

@grahamehorner
Copy link

grahamehorner commented May 11, 2018

I'm also getting this issue when binding are correct, and the Function is working under load ?
and also when using EvenHubTrigger & EventHub bindings ? this may be related to some other change, however the same error is presented in regards to the Microsoft.Azure.Amqp.resources

@Bubeee
Copy link

Bubeee commented May 11, 2018

@grahambunce hi, yesterday I've attempted to reproduce your steps on the newly-created functions project - but it was working fine. So the problem is definitely in something else.

@Bubeee
Copy link

Bubeee commented May 11, 2018

Seems like my issue was with the wrong specification of topic name. If it taken from the app settings, it should be rounded with %

Dummy. Lost quite a lot of time on this. Cause in some other trigger % symbols should be omitted, I decided to skip it here to. Terrible mistake :)

image

@grahambunce
Copy link
Author

@Bubeee @grahamehorner I think this is representative of the same problem that caught me out... if there is something set up wrong the process crashes with an error (unable to find assembly) that bears no relation to what the problem actually is, so when you hit it, you're left randomly trying things in the hope you stumble across what the issue actually is.

Will this be sorted out in the next beta package?

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

No branches or pull requests

5 participants