kiflay
kiflay

Reputation: 755

New deployed azure function returns 404 Not Found error

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.

Upvotes: 18

Views: 24396

Answers (8)

Sean
Sean

Reputation: 15144

Make sure your schedule uses 6 places and not 5, which will result in 404 errors.

i.e. use:

[TimerTrigger("0 0 */5 * * *")] TimerInfo timer

and not

[TimerTrigger("0 */5 * * *")] TimerInfo timer

Upvotes: 6

Shwetha P
Shwetha P

Reputation: 1

In my case, changing FUNCTIONS_EXTENSION_VERSION configuration value from ~1 to ~4 worked.

Upvotes: 0

Abhi
Abhi

Reputation: 79

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

Upvotes: 0

Julie
Julie

Reputation: 11

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.

Upvotes: 1

golfalot
golfalot

Reputation: 1284

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

Upvotes: 3

dnndeveloper
dnndeveloper

Reputation: 1631

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.

Upvotes: 2

Fabio Milheiro
Fabio Milheiro

Reputation: 8474

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

Upvotes: 0

kiflay
kiflay

Reputation: 755

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.

Upvotes: 10

Related Questions