Open brettsam opened 6 years ago
Thank you for creating this issue.
@jmsalvo -- I was able to create a brand-new Function app in VS and successfully start it up, so let's try to figure out what's different between our two setups.
When you look in your output folder (typically YourFunctionProject\bin\debug\netstandard2.0\bin
), do you see the Microsoft.Azure.WebJobs.Extensions.EventGrid.dll? If you right-click and view the properties and then click 'Details', does it show the Product version as 2.0.0-beta4?
I'm trying to see if maybe the new bits aren't getting dropped into your folder somehow...
Yes, I see 2.0.0-beta4 listed as the Product version for Microsoft.Azure.WebJobs.Extensions.EventGrid.dll
Can you share the console output when you hit F5? (Make sure there's no secrets that get logged...)
Not sure if this is note-worthy, but if I remove "version": "2.0" from my hosts.json file I don't see any errors when I run the function in VisualStudio. I thought this setting is required, or would be set automatically when the functions is started...but I don't see this happening.
Thanks for calling it out (you never know what the difference could be). That's expected -- if you don't have the "version" and have an otherwise-empty host.json, we'll just continue along since you wouldn't hit any breaking changes.
Another thing to try. Create a new Function app and add the same references you have above (but you can skip the ExtensionsMetadataGenerator). If you right-click and add a new function and pick EventGrid (just leave it as the default), then run -- does it work?
Ok, I will give that a try. I can also post the output from the console.
Another thing to look at -- the "extensions.json" file in your output directory. What's it have in it?
extensions.json is empty
I presume that file should be populated with the appropriate extensions, but for some reason is not
Ahh, that's likely it. Try deleting it and rebuilding? Or even delete the whole bin folder and rebuild...
I tried deleting bin folder and rebuild, but I still see an empty extensions.json file. It does seem that the extensions.json file not being populated is the culprit, just unsure how to get it updated with the correct extensions.
Can you remove your nuget reference to "Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.0.0"?
yes, I'll remove that reference.
Also can you delete the obj folder, it will force refresh the targets that are responsible for generating the extensions.json
Removing that nuget reference for the ExtensionsMetadataGenerator resolved the issue of the extensions.json file being empty. I'm now seeing extensions listed in that file. Going to try running the function
I am no longer seeing the binding extension errors when I run my function, thank you very much for your assistance.
I had the same issue with CosmosDB trigger. Removing and reinstalling the nuget package did the trick.
I had the same issue on one of our build agents (not locally) with QueueTrigger. After adding an explicit reference to the ExtensionsMetadataGenerator it works on the build agent but not locally (the extesions.json file is empty). Have tried deleting obj/bin folders and re-add reference to Microsoft.Azure.WebJobs.Extensions.Storage
Alright... so I found this issue and among the breaking changes that happened earlier... I had to install the Http
bindings because it was removed from the core runtime. Especially, if like @jmsalvo, you are running the beta37 of the runtime, you'll need to run the following:
func extensions install -p Microsoft.Azure.WebJobs.Extensions.Http -v 3.0.0-beta8
Just an FYI.
Unfortunately, I am not having any luck with this!! I tried removing and adding.....the extensions.json in the netstandard2.0 folder is empty:
{
"extensions":[
]
}
I have a VS2017 15.8.2 with several function apps in the same solution. The solution compile...I tried cleaning up, rebuilding, removing obj
and bin
folders.....no effect.
In the first function app, I have the following NuGet packages:
In the second function app, I have the following NuGet packages:
Both are generating empty extensions.json
files.
I am also at loss as to where the extensions.json file should be. I have 2 other function apps in the same solution that have no extensions. On one, i see an extension.json
in the netstandard2.0
folder and the one I see an extensions.json
file in netstandard2.0\bin
folder!!
I'm experiencing the same issue as @eilefh.
microsoft/dotnet:2.1-sdk
docker image, but it only generates the extensions.json
file when I explicitly add Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator
.Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator
is not referenced in the project, when I add the reference, extensions.json
file stop being generated properly.When I have the reference locally I have warnings when building
C:\Users\ksilva\.nuget\packages\microsoft.net.sdk.functions\1.0.19\build\netstandard1.0\Microsoft.NET.Sdk.Functions.props(38,3): warning MSB4011: "C:\Users\ksilva\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.props" cannot be imported again. It was already imported at "C:\github\azure-functions2-sample\SampleAzureFunc.Docker\obj\SampleAzureFunc.Docker.csproj.nuget.g.props (16,5)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\github\azure-functions2-sample\SampleAzureFunc.Docker\SampleAzureFunc.Docker.csproj] C:\Users\ksilva\.nuget\packages\microsoft.net.sdk.functions\1.0.19\build\netstandard1.0\Microsoft.NET.Sdk.Functions.targets(45,3): warning MSB4011: "C:\Users\ksilva\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets" cannot be imported again. It was already imported at "C:\github\azure-functions2-sample\SampleAzureFunc.Docker\obj\SampleAzureFunc.Docker.csproj.nuget.g.targets (8,5)". This is most likely a build authoring error. This subsequent import will be ignored. [C:\github\azure-functions2-sample\SampleAzureFunc.Docker\SampleAzureFunc.Docker.csproj]
You can try using this repo https://github.com/klesouza/azure-functions2-sample, if you remove the reference and build the docker image again, no extensions.json
will be created
I am having a similar issue here. Referenced in #953. Locally everything builds and runs but deployment will not run and I have observed an empty bin/extensions.json
file on the remote host.
I tried referencing Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator
explicitly via nuget (even though it is referenced from within the sdk) and everything still worked locally but no luck with the publish, still an empty extensions.json. I should mention as well I am using custom bindings.
sdk version 1.0.21
Was able to workaround my binding issue by copying over my local extensions.json file to the remote host via cloud explorer.
@klesouza, @fabiocav and all
I have the same issue in my environment. Azure DevOps build pipeline with .NET Core build task doesn't produce proper extensions.json file. Same code compiled by VS produces proper extensions.json file. BTW, no explicit reference to the Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator in the projects.
Apparently, dotnet build is different from VS build. During VS build "MSBuildRuntimeType = Full", in the dotnet build "MSBuildRuntimeType = Core". This variable controls the behavior of the task that generates extensions.json file. See .nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.1\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets file for details.
In VS, the build process uses .nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.1\tools**net46\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.dll The "dotnet build" uses .nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.1\tools\netstandard2.0**\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.dll
IMHO, the problem in the .NET Core version of the Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.dll
As a workaround, I've switched the ADO build pipeline to perform Visual Studio build instead of .NET Core. Now my CI process generates generates correct extensions.json file, consistent with the what developers workstation produces.
PS. I my case proper extensions.json has below content:
{ "extensions":[ { "name": "Startup", "typeName":"Some.Project.Startup, Some.Project, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"} ] }
@brettsam Do you guys have any news on this one?
@brettsam any update here?
I'm pretty sure we've solved all of the original issues (moving ExtensionsMetadataGenerator forward). Since this is a really generic error, it can happen for a number of reasons. Can anyone still seeing this please let us know your symptoms, specifically:
bin\extensions.json
file being built and correctly populated? i.e -- does it have any entries? You can check this locally (and make sure it's deployed to Azure).Note that there was recently a new ExtensionsMetadataGenerator release that fixed some issues with targeting .NET Core 2.1+. If you're having issues, give that a try by directly adding the nuget reference to the newest release: https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator/1.0.2
Specifically, I'm seeing an empty extensions.json file next to the host.json file, not in the bin.
I'm using a clean project from template v2 with BlobTrigger with updated references.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.0.2" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
If I add the workaround provided by @TomBonnerAtTFL https://github.com/Azure/azure-functions-host/pull/4059 then I get the correct output.
Edit: even with the workaround there seems to be some sort of race condition.
I'm getting metadata generation failure on my Mac.
This is a gist containing the full error message https://gist.github.com/rogeralsing/a9b1acd0fd650f4d35cb8667c7d4e5a7
The final bit is:
/Users/rogerjohansson/.nuget/packages/microsoft.azure.webjobs.script.extensionsmetadatagenerator/1.0.1/build/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(20,5): error : Metadata generation failed. [/Users/rogerjohansson/Git/FunctionLabb/FunctionLabb.csproj]
I've tried countless of times to recreate my functions using vs code from scratch, but I hit this issue 100% of the times.
Do you have a bin\extensions.json file being built and correctly populated? i.e -- does it have any entries? You can check this locally (and make sure it's deployed to Azure).
I have no such file generated, generation fails before it can create it
Are you using custom bindings that you've written?
No
@rogeralsing -- can you try updating your project to use 1.0.26 of Microsoft.NET.Sdk.Functions? https://www.nuget.org/packages/Microsoft.NET.Sdk.Functions/1.0.26? Does the issue still happen?
@brettsam yep, same issue there.
It seems to be SDK related because netcoreapp 2.0 builds fine and generates correct metadata. while 2.1 and 2.2 fails on metadata error.
I've done complete reinstalls of dotnet core on my machine. and also tried them one by one. still same issue.
Would you be able to throw your .csproj file into a gist? That may help us track down the issue...
Thanks @rogeralsing. I've split this off to a separate issue: https://github.com/Azure/azure-functions-host/issues/4181. We'll continue the investigation over there.
I'm hitting the same issue, I've opened an issue here with all my investigations so far: https://github.com/Azure/azure-functions-durable-extension/issues/692
I have no idea how to continue to investigate from here
If you debug/run from Visual Studio (F5), somehow, even with latest Microsoft.NET.Sdk.Functions (v1.0.28), its not able to detect AzureFunctions defined in the project.
I root caused the issue to Project properties > Debug > Working Directory is not set somehow by default. Set it to the actual directory where binaries are found and your AzureFunctions becomes available for debug.
PS, this would add launchSettings.json /profiles/{projectName}/workingDirectory=/objd/amd64/
I'm breaking out an issue from our announcements page into it's own topic for more back-and-forth. Original discussion started here: https://github.com/Azure/app-service-announcements-discussions/issues/64#issuecomment-417731957
From @jmsalvo