Troubleshooting Azure Functions HTTP 404 Errors: How to Fix Them

Troubleshooting Azure Functions HTTP 404 Errors: How to Fix Them

 

Issue:

·       Why Azure functions http trigger returning “HTTP ERROR 404”?

·       I verified my function URL is correct but still 404


Keywords:

  • Azure Functions HTTP trigger 404 error
  • Troubleshooting Azure Functions 404 issues
  • Resolving 404 errors in Azure Functions HTTP triggers
  • Debugging Azure Functions HTTP trigger 404s
  • Troubleshooting HTTP 404 errors in Azure Functions
  • Azure Functions HTTP trigger not found issue
  • Fixing Azure Functions HTTP 404 errors
  • Azure Functions HTTP trigger routing issues
  • Diagnosing Azure Functions HTTP trigger 404 errors

 

Solution:

This is a common phenomenon and can happens with anyone. We wonder what happens to my function app or that function which is returning 404 while my URL is valid.

First of all, what is 404 stands for?

This is an http status which indicates that resource which you are trying to access it not available to serve your http request. In other words, your client like browser, postman, code is able to communicate with server, but server didn’t find the requested resource and returned 404 not found.

Alternative status can be,

  • HTTP 404
  • 404 not found
  • Page not found
  • HTTP ERROR 404
  • 404 

A simple example from .net is, let’s say your application name is https://www.testingazure.com and you send request for default.aspx page(https://www.testingazure.com/Defalut.aspx ) which is available on server then you will get the response from default.aspx page but if this page is not available in your application the you see 404 not found.

I also encountered this issue and thought to share with everyone.

I created an HTTP trigger function under my function app and when I tried to access it through URL, I received HTTP ERROR 404.



Azure functions 404


 







I verified following points quickly,

  • My function app was up and running.
  • HTTP trigger function was available in my function app which I was calling.
  • I passed correct code/key in my URL   

What’s wrong then? Why 404?

It was confusing as I was not getting any hints until I realize that through browser you send GET request and what if my function doesn’t support GET request?

I called the same URL through POST method and it worked. It returned the result as expected.

I checked that HTTP trigger function support HTTP Methods and GET was disabled.

 

Azure functions 404


 







I enabled the GET method and send the same request again this time I received the response successfully.

Azure functions 404






Similarly, you can verify for other HTTP methods.

You can find and configure this in function.json file also.

Azure functions 404


 











According to Azure function app official documents, HTTP Methods property in azure function is “An array of the HTTP methods to which the function responds. If not specified, the function responds to all HTTP methods.”

This means, not only resource availability but also how you are accessing it can cause the HTTP 404.

So, whenever you observe HTTP 404 with your http trigger function please validate following,

  • Is your function app up and running?
  • Is HTTP trigger function available in your function app which you are calling?
  • Are you passing correct code/key in my URL?
    • This will return HTTP ERROR 401 but better to check safe side
  • Does your function support http method which you are using? 

Hope this helps. Please let me know if you have any query.

 

No comments:

Post a Comment