1

I get this error on deploying my Azure Function that is set up to my github repo (https://github.com/jthake/MicrosoftGraph-AzureFunctions/blob/master/MicrosoftGraphWebHook/). Unfortunately it is not very specific…what would be the right way to debug this?

Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.MicrosoftGraphWebHook'. mscorlib: Multiple custom attributes of the same type found.
2016-04-06T00:29:25  Welcome, you are now connected to log-streaming service.

I noticed this comment in this other thread:

"As expcted, the Azure Functions runtime will automatically add the references to the package assemblies, so you DO NOT need to explicitly add assembly references using #r "AssemblyName", you can just add the required using statements to your function and use the types defined in the NuGet package you've referenced."

I tried removing the #r ref thing that maybe already ref’d but then threw an error on couldn’t find assembly ref.

Community
  • 1
  • 1
Jeremy Thake MSFT
  • 2,058
  • 2
  • 13
  • 11
  • Removing the unused string variables gives me a different error. makes me think its not loading the NuGet right. 2016-04-06T02:17:32.089 Script for function 'MicrosoftGraphWebHook' changed. Reloading. 2016-04-06T02:17:32.089 Compiling function script. 2016-04-06T02:17:32.245 (2,1): error CS0006: Metadata file 'Microsoft.IdentityModel.Clients.ActiveDirectory' could not be found 2016-04-06T02:17:32.245 (8,17): error CS0234: The type or namespace name 'IdentityModel' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) 2016-04-06T02:17:32.245 Compilation failed. – Jeremy Thake MSFT Apr 06 '16 at 02:18
  • Jeremy, #r is **not** required for package references. Are you using CI to deploy your function? If so, are you using a custom script to perform the package restore? – Fabio Cavalcante Apr 06 '16 at 02:19
  • OK, so I went back and reomved the #r ref again (after removing the unused string ref. But I still get teh missing assembly. Here is the project.json https://github.com/jthake/MicrosoftGraph-AzureFunctions/blob/master/MicrosoftGraphWebHook/Project.json – Jeremy Thake MSFT Apr 06 '16 at 02:21
  • I am not. I was just adding to the package.json file. And set up using GitHub as per Matthew's video on Build so each commit deploys again. Should I be? – Jeremy Thake MSFT Apr 06 '16 at 02:26
  • 1
    Yes. Currently, packages are not processed on deployment, so Matthew was using this deployment script: https://github.com/fabiocav/webjobs-scripts-samples/tree/master/DeploymentScript . This is something we'll be addressing. Can you try copying both of those files to the root of your app (mapping to wwwroot) and try again? – Fabio Cavalcante Apr 06 '16 at 02:55
  • I added to the root of repo and commited it. It kicked off a new deployment job but still got same error. I checked Kudu and the files don't appear in wwwroot. host.json is there though https://github.com/jthake/MicrosoftGraph-AzureFunctions – Jeremy Thake MSFT Apr 06 '16 at 03:55
  • If things were correctly processed, you should see a project.lock.json file in your function folder in Kudu after the deployment is finished. – Fabio Cavalcante Apr 06 '16 at 03:56
  • yes. i can confirm there is a project.lock.json file in that function folder. error still shows in log in Azure Functions UI. – Jeremy Thake MSFT Apr 06 '16 at 04:02
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/108351/discussion-between-fabio-cavalcante-and-jeremy-thake). – Fabio Cavalcante Apr 06 '16 at 04:08

1 Answers1

1

I believe the issue is that your function.json file is missing the http output binding. Try adding one like below. As to why that mistake results in you getting such a cryptic error, that's an error handling bug we need to fix :)

{
  "bindings": [
    {
      "webHookType": "genericJson",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req"
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    }
  ],
  "disabled": false
}
mathewc
  • 13,312
  • 2
  • 45
  • 53
  • Unfortunately I get same error. I was copying your site-content sample @mathewc and removed the output binding you had as thought i didn't need it in there. Be great to have some validation on function.js with some useful messages in future. Understand its a preview for now. Do we have a UserVoice for this? – Jeremy Thake MSFT Apr 06 '16 at 02:01