Open Sipick opened 4 months ago
We just ran into this as well. Seems there might have been a breaking change where the __serviceUri
option is no longer supported.
We replaced "BlobConnection__serviceUri": "https://myblobaccountname.blob.core.windows.net"
with "BlobConnection__accountName": "myblobaccountname"
and that seemed to work.
We tried moving to "BlobConnection__blobServiceUri": "https://myblobaccountname.blob.core.windows.net"
but that required we set BlobConnection__queueServiceUri
which was not something we used.
NOTE: The accountName
option wasn't mentioned in any docs that I could find. I found it here reading through the source code.
@Tiberriver256 thanks for this solution, I just tested locally and it worked. Regarding the documentation, I didn't also find anything about this change or what happend with the old variable.
Description
We have a .net8 isolated function for a blob trigger, with all roles added for the storage account to use identity based connection. Same function is running in .net6 but with in-process worker runtime without any issues. We updated the functions to .net 8 isolated, but the blob trigger function throws an exception when the trigger is called. It is working fine if we use it without identity based connection, only with storage account connection string.
For test I have used a new function, an empty one, how it is generated with visual studio, I just added the connection name and the container name, and also the local.settings.json
Error received: [2024-06-21T13:05:45.733Z] Function 'Function1', Invocation id 'b65efef7-6476-41b7-9ea4-abec96e0ef79': An exception was thrown by the invocation. [2024-06-21T13:05:45.733Z] Function 'Function1', Invocation id 'cb633184-4767-4981-a6ec-276e777c034f': An exception was thrown by the invocation. [2024-06-21T13:05:45.735Z] Result: Function 'Function1', Invocation id 'b65efef7-6476-41b7-9ea4-abec96e0ef79': An exception was thrown by the invocation. Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException: Error converting 1 input parameters for Function 'Function1': Cannot convert input parameter 'stream' to type 'System.IO.Stream' from type 'Microsoft.Azure.Functions.Worker.Grpc.Messages.GrpcModelBindingData'. Error:System.ArgumentNullException: Value cannot be null. (Parameter 'connectionString') [2024-06-21T13:05:45.739Z] Result: Function 'Function1', Invocation id 'cb633184-4767-4981-a6ec-276e777c034f': An exception was thrown by the invocation. Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException: Error converting 1 input parameters for Function 'Function1': Cannot convert input parameter 'stream' to type 'System.IO.Stream' from type 'Microsoft.Azure.Functions.Worker.Grpc.Messages.GrpcModelBindingData'. Error:System.ArgumentNullException: Value cannot be null. (Parameter 'connectionString') [2024-06-21T13:05:45.740Z] at Azure.Storage.StorageConnectionString.Parse(String connectionString) [2024-06-21T13:05:45.742Z] at Azure.Storage.StorageConnectionString.Parse(String connectionString) [2024-06-21T13:05:45.743Z] at Azure.Storage.Blobs.BlobServiceClient..ctor(String connectionString, BlobClientOptions options) [2024-06-21T13:05:45.744Z] at Azure.Storage.Blobs.BlobServiceClient..ctor(String connectionString, BlobClientOptions options) [2024-06-21T13:05:45.747Z] at Microsoft.Azure.Functions.Worker.BlobStorageBindingOptions.CreateClient() in D:\a_work\1\s\extensions\Worker.Extensions.Storage.Blobs\src\Config\BlobStorageBindingOptions.cs:line 35 [2024-06-21T13:05:45.748Z] at Microsoft.Azure.Functions.Worker.BlobStorageBindingOptions.CreateClient() in D:\a_work\1\s\extensions\Worker.Extensions.Storage.Blobs\src\Config\BlobStorageBindingOptions.cs:line 35 [2024-06-21T13:05:45.750Z] at Microsoft.Azure.Functions.Worker.BlobStorageConverter.CreateBlobContainerClient(String connectionName, String containerName) in D:\a_work\1\s\extensions\Worker.Extensions.Storage.Blobs\src\BlobStorageConverter.cs:line 240 [2024-06-21T13:05:45.749Z] at Microsoft.Azure.Functions.Worker.BlobStorageConverter.CreateBlobContainerClient(String connectionName, String containerName) in D:\a_work\1\s\extensions\Worker.Extensions.Storage.Blobs\src\BlobStorageConverter.cs:line 240 [2024-06-21T13:05:45.751Z] at Microsoft.Azure.Functions.Worker.BlobStorageConverter.ConvertModelBindingDataAsync(Type targetType, BlobBindingData blobData) in D:\a_work\1\s\extensions\Worker.Extensions.Storage.Blobs\src\BlobStorageConverter.cs:line 118 [2024-06-21T13:05:45.757Z] at Microsoft.Azure.Functions.Worker.BlobStorageConverter.ConvertModelBindingDataAsync(Type targetType, BlobBindingData blobData) in D:\a_work\1\s\extensions\Worker.Extensions.Storage.Blobs\src\BlobStorageConverter.cs:line 118 [2024-06-21T13:05:45.761Z] at Microsoft.Azure.Functions.Worker.BlobStorageConverter.ConvertFromBindingDataAsync(ConverterContext context, ModelBindingData modelBindingData) in D:\a_work\1\s\extensions\Worker.Extensions.Storage.Blobs\src\BlobStorageConverter.cs:line 63 [2024-06-21T13:05:45.765Z] at Microsoft.Azure.Functions.Worker.BlobStorageConverter.ConvertFromBindingDataAsync(ConverterContext context, ModelBindingData modelBindingData) in D:\a_work\1\s\extensions\Worker.Extensions.Storage.Blobs\src\BlobStorageConverter.cs:line 63 [2024-06-21T13:05:45.769Z] at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 94 [2024-06-21T13:05:45.770Z] at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 94 [2024-06-21T13:05:45.772Z] at TestBlobTrigger.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\work\TestBlobTrigger\TestBlobTrigger\TestBlobTrigger\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 31 [2024-06-21T13:05:45.772Z] at TestBlobTrigger.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\work\TestBlobTrigger\TestBlobTrigger\TestBlobTrigger\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 31 [2024-06-21T13:05:45.774Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 [2024-06-21T13:05:45.775Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 [2024-06-21T13:05:45.776Z] at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 34 [2024-06-21T13:05:45.777Z] at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 34 [2024-06-21T13:05:45.779Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 77 Stack: at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 94 [2024-06-21T13:05:45.781Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 77 Stack: at Microsoft.Azure.Functions.Worker.Context.Features.DefaultFunctionInputBindingFeature.BindFunctionInputAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\Context\Features\DefaultFunctionInputBindingFeature.cs:line 94 [2024-06-21T13:05:45.785Z] at TestBlobTrigger.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\work\TestBlobTrigger\TestBlobTrigger\TestBlobTrigger\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 31 [2024-06-21T13:05:45.787Z] at TestBlobTrigger.DirectFunctionExecutor.ExecuteAsync(FunctionContext context) in C:\work\TestBlobTrigger\TestBlobTrigger\TestBlobTrigger\Microsoft.Azure.Functions.Worker.Sdk.Generators\Microsoft.Azure.Functions.Worker.Sdk.Generators.FunctionExecutorGenerator\GeneratedFunctionExecutor.g.cs:line 31 [2024-06-21T13:05:45.788Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 [2024-06-21T13:05:45.789Z] at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13 [2024-06-21T13:05:45.790Z] at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 34 [2024-06-21T13:05:45.791Z] at Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 34 [2024-06-21T13:05:45.792Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 77. [2024-06-21T13:05:45.793Z] at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 77.
Steps to reproduce
Create new function project for a blob trigger Use identity based connection to get blobs Start function and add a blob to the container local.settings.json ('BlobConnection' is my connection name prefix): { "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated", "BlobConnectionserviceUri": "https://.blob.core.windows.net", "BlobConnection clientId": "" } }