How to fix an Azure Function (v2) failing with error “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.”

"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." leads to a 404 error in jQuery.

This post describes one way to resolve a problem, where you receive an error like “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.” when calling your Azure Functions.

Problem

Another day, another simple, yet kind of weird issue to solve! This time I was developing a simple Azure Function to access Microsoft Graph API. This particular issue was kind of bugging, since the error message actually had nothing to do with the actual issue and gave no pointers as to how to fix the issue!

I was just developing a function, and suddenly it stopped working, and the only error message I got was this:

In client-side code, if called with $.get(), it looks somewhat like this:

"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." leads to a 404 error in jQuery.

“The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.” leads to a 404 error in jQuery.

So, what did I do to cause this – and how to fix this?

Steps to reproduce:

For me, this is the way I caused the error.

  1. Create an Azure Function that takes in GET argument(s) using the beta version of the CLI (2.1, in my case)
  2. Call the function from any other source, passing arguments of varying length
  3. Suddenly you notice, with quite a few different arguments, you only get this error from the Azure function: “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.” It doesn’t happen with all arguments, though!
  4. When the issue is underway, even if you attach the remote debugger to your Azure Function, it won’t fire, at all – so debugging is kind of difficult!

But what on Earth causes this?

Reason: Your Azure Function can’t handle your parameters!

Weirdly enough, the reason to this issue is actually a bug (or a feature) of Azure functions CLI, or how they use IIS. Long query strings will mess it up. In IIS the default maximum length of the query string is 2048 characters (see References for more info). There was a bug report about this on GitHub (see references)

It looks like it was fixed for v1 of Azure Functions CLI, but not for v2 (beta), so I opened a new issue for v2: https://github.com/Azure/azure-functions-host/issues/3023 (Update 01.07.2018 – it’s now classified as bug, so that’s good!).

PostMan "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

Postman is no help, either. “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.”

Solution (or at least a workaround!)

The fix is simple – move the query parameters from your URL to request body. This involves possibly changing your primary request type from GET to POST. So basically, from this:

to

Should work after that!

Heh, or you could just use shorther query variable values. Long query strings cause issues in some browsers, too (well, in IE, that is).

References

The following two tabs change content below.

Antti K. Koskela

Solutions Architect / Escalations Engineer at Koskila / Norppandalotti Software / Valo Solutions
Antti Koskela is a proud digital native nomadic millenial full stack developer (is that enough funny buzzwords? That's definitely enough funny buzzwords!), who works as a Solutions Architect for Valo Intranet, the product that will make you fall in love with your intranet. Working with the global partner network, he's responsible for the success of Valo deployments happening all around the world. He's been a developer from 2004 (starting with PHP and Java), and he's been bending and twisting SharePoint into different shapes since MOSS. Nowadays he's not only working on SharePoint, but also on .NET projects, Azure, Office 365 and a lot of other stuff.This is his personal professional (e.g. professional, but definitely personal) blog.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.