Hi,
I am testing an azure function using the standard template Azure Blogb Trigger. The aim is to read CSV files from a blob using the managed identity. The role assignments are fine.
Here is the local.settings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "python",
"AZURE_STORAGE_HOST": "blob.core.windows.net",
"AZURE_STORAGE_ACCOUNT": "mystorage",
"AZURE_STORAGE_CONTAINER": "data"
}
}
And here is the function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "myblob",
"type": "blobTrigger",
"direction": "in",
"path": "folderInBlob/{blobName}",
"connection": "AzureWebJobsStorage"
}
]
}
and the init file:
import logging
import azure.functions as func
def main(myblob: func.InputStream):
logging.info(f"Python blob trigger function processed blob \n"
f"Name: {myblob.name}\n"
f"Blob Size: {myblob.length} bytes")
Its a pretty standard code that comes with init.
The error I receive is:
[2022-04-09T16:29:50.335Z] An unhandled exception has occurred. Host is shutting down.
[2022-04-09T16:29:50.335Z] Microsoft.Azure.Storage.Common: Connection refused (127.0.0.1:10001). System.Net.Http: Connection refused (127.0.0.1:10001). System.Net.Sockets: Connection refused.
[2022-04-09T16:29:53.075Z] The listener for function 'Functions.blobCheck' was unable to start.
[2022-04-09T16:29:53.075Z] The listener for function 'Functions.blobCheck' was unable to start. Azure.Core: Retry failed after 6 tries. Retry settings can be adjusted in ClientOptions.Retry. (Connection refused (127.0.0.1:10000)) (Connection refused (127.0.0.1:10000)) (Connection refused (127.0.0.1:10000)) (Connection refused (127.0.0.1:10000)) (Connection refused (127.0.0.1:10000)) (Connection refused (127.0.0.1:10000)). Azure.Core: Connection refused (127.0.0.1:10000). System.Net.Http: Connection refused (127.0.0.1:10000). System.Private.CoreLib: Connection refused.
[2022-04-09T16:29:53.078Z] Host started (26250ms)
[2022-04-09T16:29:53.078Z] Job host started
[2022-04-09T16:29:53.176Z] Stopping host...
[2022-04-09T16:29:53.191Z] Stopping JobHost
[2022-04-09T16:29:53.200Z] Job host stopped
info: Grpc.AspNetCore.Server.ServerCallHandler[14]
Error reading message.
System.IO.IOException: The request stream was aborted.
---> Microsoft.AspNetCore.Connections.ConnectionAbortedException: The HTTP/2 connection faulted.
--- End of inner exception stack trace ---
at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
at System.IO.Pipelines.Pipe.GetReadAsyncResult()
at System.IO.Pipelines.Pipe.DefaultPipeReader.GetResult(Int16 token)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.Http2MessageBody.ReadAsync(CancellationToken cancellationToken)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
at Grpc.AspNetCore.Server.Internal.PipeExtensions.ReadStreamMessageAsync[T](PipeReader input, HttpContextServerCallContext serverCallContext, Func`2 deserializer, CancellationToken cancellationToken)
[2022-04-09T16:29:53.227Z] Host shutdown completed.
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'gRPC - /AzureFunctionsRpcMessages.FunctionRpc/EventStream'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/2 POST http://127.0.0.1:35037/AzureFunctionsRpcMessages.FunctionRpc/EventStream application/grpc - - 200 - application/grpc 25910.1334ms
info: Microsoft.AspNetCore.Server.Kestrel[32]
Connection id "0HMGQ8OEPFOF0", Request id "0HMGQ8OEPFOF0:00000001": the application was completed without reading the entire request body.
The host in local settings json file is blob.core.windows.net but in the error above it says Connection refused (127.0.0.1:10001 why is it trying to connect the localhost?
Also, I am working on an azure compute connected via vscode. Is this error related to that?