Reputation: 115
I have one old Azure Functions project (v3). It contains several timer triggered functions. They stopped working on VS2022. You can see the logs below. If I create a new Functions project via VS2022, it will work fine. Looks like Azurite also starts up fine. Setting "AzureWebJobsStorage" equals "UseDevelopmentStorage=true". What can I do?
[2022-01-06T10:17:15.675Z] Host lock lease acquired by instance ID '000000000000000000000000DC2A3C3E'.
[2022-01-06T10:17:35.554Z] The listener for function 'Function1' was unable to start.
[2022-01-06T10:17:35.556Z] The listener for function 'Function1' was unable to start. Azure.Storage.Blobs: Service request failed.
[2022-01-06T10:17:35.557Z] Status: 500 (Internal Server Error)
[2022-01-06T10:17:35.557Z]
[2022-01-06T10:17:35.558Z] Headers:
[2022-01-06T10:17:35.559Z] Server: Azurite-Blob/3.14.1
[2022-01-06T10:17:35.560Z] ETag: "0x234B8B049DD4280"
[2022-01-06T10:17:35.561Z] x-ms-blob-type: BlockBlob
[2022-01-06T10:17:35.562Z] x-ms-lease-state: available
[2022-01-06T10:17:35.562Z] x-ms-lease-status: unlocked
[2022-01-06T10:17:35.563Z] x-ms-client-request-id: a3bc0141-7bcb-420c-84a9-eadf86f8c685
[2022-01-06T10:17:35.564Z] x-ms-request-id: 88474d4b-bc15-4f45-95d5-0a01682d883d
[2022-01-06T10:17:35.565Z] x-ms-version: 2020-10-02
[2022-01-06T10:17:35.566Z] Accept-Ranges: bytes
[2022-01-06T10:17:35.566Z] Date: Thu, 06 Jan 2022 10:17:35 GMT
[2022-01-06T10:17:35.567Z] x-ms-server-encrypted: true
[2022-01-06T10:17:35.570Z] x-ms-blob-content-md5: jhxvLoUrRfc2dXn/gXokig==
[2022-01-06T10:17:35.570Z] Connection: keep-alive
[2022-01-06T10:17:35.571Z] Keep-Alive: REDACTED
[2022-01-06T10:17:35.572Z] Last-Modified: Tue, 28 Dec 2021 11:10:44 GMT
[2022-01-06T10:17:35.573Z] Content-Length: 115
[2022-01-06T10:17:35.574Z] Content-Type: application/octet-stream
[2022-01-06T10:17:35.574Z] Content-MD5: jhxvLoUrRfc2dXn/gXokig==
UPDATE
I have added few new functions to the same project. They work fine. I have changed function and method names and old functions also start working. Looks like it caches somewhere names. I tried clean rebuild but it didn't help. I have no idea why it doesn't work with old names.
Upvotes: 11
Views: 9382
Reputation: 1072
I was able to solve this issue by using Azure Storage Explorer and deleting the related blob folder under azure-webjobs-hosts in the local storage blob container
The root folders will be found at:
Local & Attached > Storage Accounts > (Emulator - Default Ports) > Blob Containers -> azure-webjobs-hosts
Make sure the project is open or Storage Explorer may not load the containers.
Once deleted, the problem function began running as expected
Upvotes: 41
Reputation: 8244
Created the Azure Functions v3 Project in Visual Studio 2019 along with the azurite extension to the project and running locally:
Same Code opened in VS 2022 and run the function locally:
As given in the Microsoft Documentation, Azurite is automatically available with the VS 2022.
When you open the Azure Functions v3 project (earlier created in VS 2019) in VS 2022 now, it might show this messages in the output dialog box after loading the dependencies:
Still, the Azure Storage Emulator is required to run any azure functions project in the Windows, it needs to be installed in the system.
Make sure the Azure Storage Emulator is installed and the azurite is a future storage emulator platform included with VS 2022. If you're using earlier Visual Studio, you'll need to install Azurite by using either Node Package Manager, DockerHub, or by cloning the Azurite github repository given in the following documentation.
Upvotes: 0