New deployed azure function returns 404 Not Found error

Viewed 8049

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.
4 Answers

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.

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.

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

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

Related