Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Functions Not Generating extensions.json

I have an Azure Functions Project with multiple functions, triggered by ServiceBus and BlobStorage.

They have been building and deploying to azure fine for a couple months now.
Something happened recently and they are no longer deploying from my build machine with an error in Azure when you click on the function Error: The binding type(s) 'blobTrigger' are not registered.
It is still deploying fine from my dev machine though. They are using WEBSITE_RUN_FROM_ZIP to deploy the code itself.

I pulled the publish directory from both my dev machine and the build machine and it appears that the file extensions.json is getting generated locally but is not on the build machine, along with empty localization folders that don't exist on the build machine and about 10mb difference in size that I can't account for yet.
The Azure Functions are targeting .Net Standard 2.0. Checking the .Net versions, .Net core is the same version across the build and dev machines.

What causes this file to get generated?

like image 966
Chris Avatar asked Mar 05 '23 09:03

Chris


2 Answers

One of the possible reasons could be an update to Azure Functions v2.0

That could explain sudden change causing errors for functions that as you mention were working till a couple of months ago.

Take a look at this issue https://github.com/Azure/azure-functions-host/issues/3363#issuecomment-417926456

it's very similar to yours.

One of the changes in v2.0 is that you need to reference the storage extensions when working with storage related triggers

Reference the Storage Extension where appropriate If you have functions that work with Azure Storage (queue/tables/blob) either with triggers, input bindings or output bindings, you'll need to reference the new Microsoft.Azure.WebJobs.Extensions.Storage extension.

Here is a link that documents all the breaking changes - Azure Functions Runtime 2.0.12050-alpha breaking changes notice

like image 146
Rohit Saigal Avatar answered Mar 11 '23 03:03

Rohit Saigal


I have been able to work around the issue by following the advice in this Github comment.

Essentially sometimes you have to include an extra dependency to get msbuild/visual studio to run the post build steps and generate your extensions file.
Add Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator as a dependency to your functions project and it should always (so far) build your publish directory properly.

Per usual, leaving the question open for someone to tell us why this is needed.

like image 24
Chris Avatar answered Mar 11 '23 04:03

Chris