This post was most recently updated on January 6th, 2023.
3 min read.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! I was developing a simple Azure Function to access Microsoft Graph API this time. This particular issue was kind of bugging me 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:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
In client-side code, if called with $.get([URL]), it looks somewhat like this (see below):
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.
- Create an Azure Function that takes in GET argument(s) using the beta version of the CLI (2.1, in my case)
- Call the function from any other source, passing arguments of varying length
- 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!
- 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 rather difficult!
But what on Earth causes this?
Reason: IIS hosting your Azure Function can’t handle your parameters
Weirdly enough, the reason for 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!- Update 01.08.2018 – this is now fixed (I guess in Release 28 of Azure Functions 2.x)! If you’re running the latest CLI version, you should be good with longer parameters too :)
However, if you’re using v1 of the Azure Functions runtime, or a post-GA version of v2 runtime (anything after Release 28 – so anything released in late 2018 or later), you shouldn’t run into this issue anymore.
But what if you do? Well, the same solution still applies, so see below:
Solution (or at least a workaround!)
The fix is simple – move the query parameters from your URL to the request body. This involves possibly changing your primary request type from GET to POST. Since this issue is caused by IIS configuration, the “fix” (I guess it’s more of a workaround) applies to both Azure Functions hosted on IIS and actual IIS sites.
So basically, from this:
$.get([url?parameter_1=A lot of information¶meter_2=Waaaay more information...]);
to
$.post([url], { paramater_1: "A lot of information", parameter_2: "Waaaay more information..." } );
Should work after that!
…Or you could just use shorter query variable values. Long query strings cause issues in some browsers, too (well, in IE, that is)… So it might be a good idea to steer clear from them anyways!
References
- Getting started with Azure Function development locally: https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local
- IIS default query string length limitation: https://docs.microsoft.com/en-us/iis/configuration/system.webServer/security/requestFiltering/requestLimits/
- A bug on GitHub about this issue in v1: https://github.com/Azure/azure-functions-host/issues/2331
- The bug I opened on GitHub about the issue: https://github.com/Azure/azure-functions-host/issues/3023
- How to fix PowerToys FancyZones in Windows 11? - September 24, 2024
- How to export the whole SSL (or TLS) certificate chain based on the original using PowerShell? - September 17, 2024
- How to solve keyboard shortcuts not working in Google Chrome on Windows? - September 10, 2024