Azure-Samples / signalr-service-quickstart-serverless-chat

Serverless chat quickstart samples for Azure SignalR
MIT License
75 stars 61 forks source link

"Cannot bind parameter" errors in sample #9

Open halter73 opened 5 years ago

halter73 commented 5 years ago

I was unable to follow the quickstart at https://docs.microsoft.com/en-us/azure/azure-signalr/signalr-quickstart-azure-functions-csharp

When I try to launch the sample from VS/func.exe, I get the following output:

[5/10/2019 11:52:20 PM] 2 functions loaded
[5/10/2019 11:52:20 PM] WorkerRuntime: dotnet. Will shutdown other standby channels
[5/10/2019 11:52:20 PM] Generating 2 job function(s)
[5/10/2019 11:52:20 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'messages'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRMessages' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[5/10/2019 11:52:20 PM] Error indexing method 'messages'
[5/10/2019 11:52:20 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'messages'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRMessages' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[5/10/2019 11:52:20 PM] Function 'messages' failed indexing and will be disabled.
[5/10/2019 11:52:21 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'negotiate'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'connectionInfo' to type SignalRConnectionInfo. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[5/10/2019 11:52:21 PM] Error indexing method 'negotiate'
[5/10/2019 11:52:21 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'negotiate'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'connectionInfo' to type SignalRConnectionInfo. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[5/10/2019 11:52:21 PM] Function 'negotiate' failed indexing and will be disabled.
[5/10/2019 11:52:21 PM] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).

I'm just trying to run the latest master with func.exe from AzureFunctionTools release 2.22.0.

Below details the only changes to master (79fd8d99547afc2d71c2760a15be06cf65fadb80) that I've tried:

[master ≡ +0 ~1 -1 ~]> git diff --cached
diff --git a/src/chat/csharp/FunctionApp.csproj b/src/chat/csharp/FunctionApp.csproj
index e614bef..d9e60d5 100644
--- a/src/chat/csharp/FunctionApp.csproj
+++ b/src/chat/csharp/FunctionApp.csproj
@@ -1,11 +1,11 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<EF><BB><BF><Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <AzureFunctionsVersion>v2</AzureFunctionsVersion>
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.0.0" />
-    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
+    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.27" />
   </ItemGroup>
   <ItemGroup>
   </ItemGroup>
@@ -13,7 +13,7 @@
     <None Update="host.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
-    <None Update="local.settings.sample.json">
+    <None Update="local.settings.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToPublishDirectory>Never</CopyToPublishDirectory>
     </None>
diff --git a/src/chat/csharp/local.settings.sample.json b/src/chat/csharp/local.settings.sample.json
deleted file mode 100644
index c5b2d4b..0000000
--- a/src/chat/csharp/local.settings.sample.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-  "IsEncrypted": false,
-  "Values": {
-    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
-    "AzureSignalRConnectionString": "<signalr-connection-string>"
-  },
-  "Host": {
-    "LocalHttpPort": 7071,
-    "CORS": "http://localhost:8080,https://azure-samples.github.io",
-    "CORSCredentials": true
-  }
-}
\ No newline at end of file
[master ≡ +0 ~1 -1 ~]> cat .\local.settings.json
{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureSignalRConnectionString": "<REDACTED>"
  },
  "Host": {
    "LocalHttpPort": 7071,
    "CORS": "http://localhost:8080,https://azure-samples.github.io",
    "CORSCredentials": true
  }
}
wanlwanl commented 5 years ago

It works for me. The same version of AzureFunctionTools and binding extension. Could you clear all cache and rebuild the solution?

JialinXin commented 5 years ago

@halter73 I did similar changes to upgrade Microsoft.NET.Sdk.Functions to 1.0.27. But I'm not be able to repro it from my side. From the error message, it seems not able to recognize SignalR binding extension. Which version of function core tools are you using? Below is the starting log from my side FYI. Would you upgrade to latest for a try?

Azure Functions Core Tools (2.7.1158 Commit hash: f2d2a2816e038165826c7409c6d10c0527e8955b)
Function Runtime Version: 2.0.12438.0
halter73 commented 5 years ago

I ran npm install -g azure-functions-core-tools to get func (2.7.1158 Commit hash: f2d2a2816e038165826c7409c6d10c0527e8955b) on my path and that seems to have resolved the issue.

Prior to that, I had never installed azure-functions-core-tools, and instead just ctrl+f5'd from a fresh install of VS 16.1.0 Preview 3 which uses AppData\Local\AzureFunctionsTools\Releases\2.22.0\cli\func.exe.

After installing azure-functions-core-tools using npm, ctrl+f5 now works from VS even though VS still uses the func.exe in local AppData folder.

wanlwanl commented 5 years ago

Great to hear that it works. It is wired that you have to manually install function tool.

yogamayaneualto commented 4 years ago

I am getting the error as "The 'messages' function is in error: The binding type(s) 'SignalR' are not registered. Please ensure the type is correct and the binding extension is installed" "The 'negotiate' function is in error: The binding type(s) 'SignalRConnectionInfo' are not registered. Please ensure the type is correct and the binding extension is installed:..The version is 2.7.2184 but still getting this error