Azure-functions-vs-build-sdk: Latest v1.0.0 not working with ServiceBus. alpha 6 still works.

Created on 17 Aug 2017  路  8Comments  路  Source: Azure/azure-functions-vs-build-sdk

I updated my VS 2017 to version 15.3 (the latest). I also installed Azure functions extension (Visual Studio 2017 Tools for Azure Functions) and Microsoft.NET.Sdk.Functions -Version 1.0.0.
Prior to the update, I was using the 15.3 preview and Microsoft Azure WebJobs Tools extension with Install-Package Microsoft.NET.Sdk.Functions alpha 6. My Azure functions worked fine with Service Bus binding as output.
After the update, the output binding stopped working.
Error message:
Microsoft.Azure.WebJobs.Host: Error indexing method 'FunctionName'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'test' to type String&. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

I reverted back to Microsoft.NET.Sdk.Functions alpha 6, everything works again.

bug

All 8 comments

[FunctionName("CreateApp")] public static HttpResponseMessage CreateApp([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, [ServiceBus("writequeue", Connection = "AzureWebJobsServiceBus")] out string test, TraceWriter log)

@bwwilliam I can repro this, looks like a regression.

@MikeStall Could you take a look?

The big change was that Script and SDK use the same binding pipeline now. This means the ServiceBusScriptBinding provider glue is now skipped.

SDK supports 'out string' binding for ServiceBus. Some theories: Maybe there's an issue loading the ServiceBus bindiong in the first place. OR perhaps there's an issue with the Connection handling.

This is related to the lazy load. We're not picking up the service bus extension, hence the indexing error. (https://github.com/Azure/azure-webjobs-sdk-script/issues/1637)

The reason for that is that ServiceBus extension is different than the others. We expect extensions to have a public parameterless config object that implements IExtensionConfigProvider.

  1. SB is internal (https://github.com/Azure/azure-webjobs-sdk/blob/663a508e8a851629c26a51e7de3af36629dfd120/src/Microsoft.Azure.WebJobs.ServiceBus/Config/ServiceBusExtensionConfig.cs#L17 ) so our scan for ExportedTypes misses it (see https://github.com/Azure/azure-webjobs-sdk-script/blob/b1445485807bb190ba0716af1a8dc81a864b5228/src/WebJobs.Script/Host/ScriptHost.cs#L735) .
  2. SB's config does not have a parameterless ctor, so the Activator.createInstance call will fail too.

This hotfix (which we made to script runtime) https://github.com/Azure/azure-webjobs-sdk-script/pull/1804 would fix it; but that would need to be pulled to CLI.

Hi @MikeStall , is there currently any workaround from a developers perspective other than dropping back down to 1.0.0-alpha6 version of the SDK?

We'll have a new build of the Core Tools soon. Right now Azure has the fix but the Core Tools do not.

I ran into what is perhaps a related issue when using imperative binding to a ServiceBus. My signature (although it probably doesn't help much, being imperative):

public async static Task Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log, Binder binder)

I had this function successfully adding a brokered message to a topic while debugging from the local func.exe host back in early August, but in the past few weeks, the host generates this error:

[9/15/2017 5:33:10 PM] A ScriptHost error has occurred
[9/15/2017 5:33:10 PM] Microsoft.Azure.WebJobs.Host: No binding found for attribute 'Microsoft.Azure.WebJobs.ServiceBusAttribute'.

The ServiceBusAttribute is being set in the function and it is working well when deployed to Azure.

Is it related, or is this a new issue?

This should be fixed. @Geoff603 sorry for the delay. If you're still seeing that error then it's a different issue. Please open another issue on this repo https://github.com/Azure/azure-functions-host

Was this page helpful?
0 / 5 - 0 ratings