18

Hey I have deployed new azure function using Azure dev ops CI/CD. The function app has been deployed successfully and when I go to the main URL, it says your function app is running. I tried to test the end points("/save") using azure portal and the output is 404 Not found. The same results when I use POST man as well. Any help would be appreciated?

enter image description here

 2020-11-21T11:30:45.769 [Error] The following 2 functions are in error:
 Get: The function type name 'DocumentContextFunction.Functions.GetDocument' 
 is invalid.
 Save: The function type name 
 'DocumentContextFunction.Functions.SaveDocument' is invalid.
kiflay
  • 699
  • 2
  • 7
  • 14
  • what is the endpoint? did you try to check logs with kudu? – Sajeetharan Nov 21 '20 at 10:48
  • the end point is : https://dev-document-function.azurewebsites.net/api/Save I have only checked the logs in application insight, nothing is there. How can I check the logs in Kudu? – kiflay Nov 21 '20 at 11:32
  • https://www.gatevnotes.com/kudu-microsoft-azure-app-service-continuous-deployment-script/ – Sajeetharan Nov 21 '20 at 11:48
  • thanks @Sajeetharan, i got the two errors: Get: The function type name 'DocumentContextFunction.Functions.GetDocument' is invalid. Save: The function type name 'DocumentContextFunction.Functions.SaveDocument' is invalid. – kiflay Nov 21 '20 at 11:53

6 Answers6

9

I have fixed this by updating the value of the "FUNCTIONS_EXTENSION_VERSION" from 1 to 3. For some reason every time I deployed using Azure CI/CD, its value is set to 1, so I have to manually change it to be 3.

kiflay
  • 699
  • 2
  • 7
  • 14
  • Thanks for your sharing. Kindly [mark your reply as an answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work), in case someone else faces this same error message – PatrickLu-MSFT Nov 30 '20 at 08:17
  • I suspect that the value is set to 1 because Azure reads from a host.json file somewhere (or can't find one) where the version is set to 1 or not specified when you are deploying the function. – CMD Nov 25 '22 at 11:00
3

I encountered this error when my build targeted win-x64 whereas the Azure Function Platform was configured as 32 bit.

golfalot
  • 956
  • 12
  • 22
  • thanks for sharing. for me was the same, i was using Visual Studio Publish to deploy, and that was targeting 32bits and my function app in azure was also 32bits. When i configured Teamcity with octopus, i didnt realize that TC was targeting 64bits and i couldnt realize what was wrong that until i found your post :) Changed the function app in azure to be 64bits – jrivam Aug 25 '22 at 13:49
2

In my case I had a function created in portal. I then published a function via visual studio. After publishing the portal created function was 404 not found and I could not even delete the function from the portal.

Exact same code in a new function worked as expected.

This is not intuitive and were no indications in the portal that previous portal created functions would break.

This maybe buried somewhere in documentation but I would have expected a warning in azure before allowing other functions to break without code changes.

dnndeveloper
  • 1,631
  • 2
  • 19
  • 36
0

The author's question helped me understand where the problem was coming from. In my case, it was not about the CI/CD pipeline doing anything funny.

It was my IaC code which was not setting up the function app properly. It picks version ~1 by default but I had to set it to ~3.

enter image description here

Fabio Milheiro
  • 8,100
  • 17
  • 57
  • 96
0

My function apps were working until I included a new custom package with a later version of Microsoft.Extensions.Logging. My functions were using Microsoft.Extensions.Logging 2.1.1. The package had version 7.0.0, which is for Net7. It was incompatible with my Net6 projects.

When the package was added, the Microsoft.Extensions.Logging version in my project was updated to 7.0.0. The were no compile errors, but debugging showed that the assembly could not be loaded. This was causing the 404.

Changing the package version back to 2.1.1 corrected the problem.

Julie
  • 1
0

This is what worked for me...

Note: I was getting 404 on my function which is a nodejs and inline editing on the browser.

  1. Open your function.json and take a backup as we are going to change it.
  2. See if in your function.json there are two different settings with "direction": "in"

For me there were two. I tried deleting but it keep coming back.

Next I went to 'Integrations' (on left menu) and opened my trigger and deleted it. This will recycle your trigger. And hope this works for you too.

enter image description here

Abhi
  • 81
  • 2
  • 3