I have created a sample Blobtrigger Azure function and would like to debug it with Azurite in VScode. However it always throws the same error after a debugging session is started.
I am using Azurite for mocking the Blob Service in Azure.
Docker command:
docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite
The code I have in the repository is as follows:
local.settings.json, with default connection string to Azurite
{"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;"
},
__init__.py
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")
and function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "myblob",
"type": "blobTrigger",
"direction": "in",
"path": "cleansed-zone/{name}",
"connection": "AzureWebJobsStorage"
}
]
}
After clicking run and debug in VSCode, an exception is always thrown.
Azure.Core: An error occurred while sending the request.
Due to some environment constraints, I could not set up HTTPS on Azurite Docker and not yet able to verify what is the root cause of the error.
Any working setup guidelines for Azurite and Function App local projects would be appreciated.
Edit: Replace the connectionstring to a Cloud storage account on Azure runs without any issue. Storage explorer also works fine when uploading sample files to Azurite. However docker keep throwing multiple 404 errors when debugging, and failed to create some blob/queues/tables which are compulsory for function apps
172.17.0.1 - - [19/Jan/2022:11:22:53 +0000] "HEAD /devstoreaccount1/azure-webjobs-blobtrigger-lex10242-1234567890?comp=metadata HTTP/1.1" 404
172.17.0.1 - - [19/Jan/2022:12:47:49 +0000] "PUT /devstoreaccount1/azure-webjobs-hosts/locks/lez10242-1234567890/WebJobs.Internal.Blobs.Listener?comp=lease HTTP/1.1" 404 -