Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No job functions found" after updating to 2.0.12050.0 #928

Open
brettsam opened this issue Aug 31, 2018 · 40 comments
Open

"No job functions found" after updating to 2.0.12050.0 #928

brettsam opened this issue Aug 31, 2018 · 40 comments

Comments

@brettsam
Copy link
Member

I'm breaking out an issue from our announcements page into it's own topic for more back-and-forth. Original discussion started here: Azure/app-service-announcements-discussions#64 (comment)

From @jmsalvo

I thought I made all the necessary updates following the 'breaking changes notice' details, but I am seeing this error "No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.). Then, I see "the binding types are not registered. Please ensure the type is correct and the binding extension is installed". As far as I am aware, I have all the extensions installed. Not sure what is meant by 'startup code', I presume I'm missing some configuration or setup that is now required in my function?

I'm running locally in VisualStudio, I see a 'Starting Host' message indicating the Functions Runtime Version is 2.0.12050.0. The binding types the message suggests are not registered are: activityTrigger, eventGridTrigger and orchestrationTrigger.

The following are the referenced packages:
"Microsoft.Azure.WebJobs.Extensions.CosmosDB" Version="3.0.1-beta2"
"Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.6.0"
"Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="2.0.0-beta4"
"Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.0.0"
"Microsoft.NET.Sdk.Functions" Version="1.0.19"

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

Thank you for creating this issue.

@brettsam
Copy link
Member Author

@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...

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

Yes, I see 2.0.0-beta4 listed as the Product version for Microsoft.Azure.WebJobs.Extensions.EventGrid.dll

@brettsam
Copy link
Member Author

Can you share the console output when you hit F5? (Make sure there's no secrets that get logged...)

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

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.

@brettsam
Copy link
Member Author

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.

@brettsam
Copy link
Member Author

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?

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

Ok, I will give that a try. I can also post the output from the console.

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

consoleoutput

@brettsam
Copy link
Member Author

Another thing to look at -- the "extensions.json" file in your output directory. What's it have in it?

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

extensions.json is empty

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

I presume that file should be populated with the appropriate extensions, but for some reason is not

@brettsam
Copy link
Member Author

Ahh, that's likely it. Try deleting it and rebuilding? Or even delete the whole bin folder and rebuild...

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

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.

@brettsam
Copy link
Member Author

Can you remove your nuget reference to "Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.0.0"?

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

yes, I'll remove that reference.

@soninaren
Copy link
Member

Also can you delete the obj folder, it will force refresh the targets that are responsible for generating the extensions.json

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

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

@jmsalvo
Copy link

jmsalvo commented Aug 31, 2018

I am no longer seeing the binding extension errors when I run my function, thank you very much for your assistance.

@marnheus
Copy link

marnheus commented Sep 1, 2018

I had the same issue with CosmosDB trigger.
Removing and reinstalling the nuget package did the trick.

@eilefh
Copy link

eilefh commented Sep 6, 2018

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

@MaximRouiller
Copy link

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.

@khaledhikmat
Copy link

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:

  • AzureAdvocates.Webjobs.Extensions.SignalrService (0.3.0.-alpha)
  • Microsoft.Azure.Webjobs.Extensions.EventGrid (2.0.0.-beta4)
  • Microsoft.Azure.Webjobs.Extensions.Storage (3.0.0.-beta8)
  • Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator (1.0.0)
  • Microsoft.Net.Sdk.Functions (1.0.19)

In the second function app, I have the following NuGet packages:

  • Microsoft.Azure.Webjobs.Extensions.DurableTask (1.6.0)
  • Microsoft.Azure.Webjobs.Extensions.Storage (3.0.0.-beta8)
  • Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator (1.0.0)
  • Microsoft.Net.Sdk.Functions (1.0.19)

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!!

@klesouza
Copy link

I'm experiencing the same issue as @eilefh.

  • In my automated build process, I'm building my azure functions using microsoft/dotnet:2.1-sdk docker image, but it only generates the extensions.json file when I explicitly add Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator.
  • When building locally with VS, it works properly when the 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

@ede0m
Copy link

ede0m commented Sep 18, 2018

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

@ede0m
Copy link

ede0m commented Sep 18, 2018

Was able to workaround my binding issue by copying over my local extensions.json file to the remote host via cloud explorer.

@gaikovoi
Copy link

gaikovoi commented Oct 4, 2018

@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"} ] }

@klesouza
Copy link

@brettsam Do you guys have any news on this one?

@ColbyTresness
Copy link

@brettsam any update here?

@ColbyTresness ColbyTresness added this to the Active Questions milestone Feb 20, 2019
@brettsam
Copy link
Member Author

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:

  • 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).
  • Are you using custom bindings that you've written?

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

@davidkassa
Copy link

davidkassa commented Feb 21, 2019

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 Azure/azure-functions-host#4059 then I get the correct output.

Edit: even with the workaround there seems to be some sort of race condition.

@rogeralsing
Copy link

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.

@rogeralsing
Copy link

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

@brettsam
Copy link
Member Author

@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?

@rogeralsing
Copy link

@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.

@brettsam
Copy link
Member Author

Would you be able to throw your .csproj file into a gist? That may help us track down the issue...

@rogeralsing
Copy link

@brettsam
Copy link
Member Author

Thanks @rogeralsing. I've split this off to a separate issue: Azure/azure-functions-host#4181. We'll continue the investigation over there.

@juchom
Copy link

juchom commented Apr 16, 2019

I'm hitting the same issue, I've opened an issue here with all my investigations so far:
Azure/azure-functions-durable-extension#692

I have no idea how to continue to investigate from here

@AAATechGuy
Copy link

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/

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests