Azure / azure-functions-signalrservice-extension

Azure Functions bindings for SignalR Service. Project moved to https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/signalr/Microsoft.Azure.WebJobs.Extensions.SignalRService .
MIT License
97 stars 48 forks source link

Using binding expressions of the app settings in the function.json does not work with signalRTrigger #252

Open anastasios-captureone opened 3 years ago

anastasios-captureone commented 3 years ago

Using these instructions, if the function.json contains any app settings binding expressions, then it doesn't work (seems that the app settings are not being replaced).

So this works:

{
  "type": "signalRTrigger",
  "name": "invocation",
  "category": "connections",
  "event": "connected",
  "direction": "in",
  "hubName": "someHubName", // This works.
  "connectionStringSetting": "SIGNALR_CONNECTION_STRING"
}

So this doesn't work:

{
  "type": "signalRTrigger",
  "name": "invocation",
  "category": "connections",
  "event": "connected",
  "direction": "in",
  "hubName": "%HUB_NAME%", // This doesn't work. HUB_NAME is an application setting.
  "connectionStringSetting": "SIGNALR_CONNECTION_STRING"
}

Am I correct to assume that the SignalRTriggerDispatcher is tricked that there are no SignalRMethodExecutor, at this line, because the %% value is used in the dictionary as the hubName, instead of the actual app setting?

Y-Sindo commented 3 years ago

This is a known bug already fixed but not released in bundle 3.x version. Are you using bundle 3.x version? The fix is planned to be released by July 16.

anastasios-captureone commented 3 years ago

We have been using v2.x of the bundles. Will this get cherrypicked to the v2? AFAIK many of the extensions of the v3.x are in preview, so we would rather not upgrade there yet.

Y-Sindo commented 3 years ago

Bundles 2.2.0 contains the newest SignalR version. Do you try the bundles 2.2.0 and still not working?

anastasios-captureone commented 3 years ago

I can confirm I'm still seeing this locally with

  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  }

This is is the extensions it downloaded:

[2021-06-29T06:32:02.694Z] Found a matching extension bundle at /home/anastasios/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.6.1
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.CosmosDB" Version="3.0.9" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.4.1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="2.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="4.2.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Kafka" Version="3.2.1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.RabbitMQ" Version="1.0.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SendGrid" Version="3.0.2" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="4.2.1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.2.2" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.4" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Twilio" Version="3.0.2" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.7" />
    <PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
    <PackageReference Include="System.Security.Principal.Windows" Version="4.3.0" />
  </ItemGroup>
</Project>
Y-Sindo commented 3 years ago
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.2.2" />

This is not the newest SignalR extension version. The newest one is 1.4.2. I can see the bundles 2.2.0 is released from this. But the extension bundles you used is higher than 2.2.0 while still with an old SignalR Service version... Is your azure-functions-core-tools the latest version?

anastasios-captureone commented 3 years ago
npm outdated -g
Package                      Current    Wanted    Latest  Location
azure-functions-core-tools  3.0.3568  3.0.3568  2.7.3188  global

Wait I'm confused. The link you have points to ExtensionBundle 2.2 as the latest? How come the tools downloaded 2.6.1 ? .azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.6.1

Y-Sindo commented 3 years ago

I am also confused, as I am not an expert of Azure Functions. You might want to turn to Azure Functions team. I will also look for help through internal channels.

Y-Sindo commented 3 years ago

Just confirm that there is something wrong with the bundle release. Next release should fix this problem. You can get the update ASAP by subscribing to the repo release messages https://github.com/Azure/azure-functions-extension-bundles/ .The next release is supposed to be somewhere between 2-4 weeks.

anastasios-captureone commented 3 years ago

@Y-Sindo any updates on this? Who should we contact to create a new release on the https://github.com/Azure/azure-functions-extension-bundles/ ?

Y-Sindo commented 3 years ago

Still waiting for response from Azure Functions team. You might want to contact naren.soni@microsoft.com for the bundle releases.