Reputation: 33
One of our Azure Functions (running 2.0) should return a RedirectResult (gets triggered by an external webhook, does some processing and should do a redirect to a web page).
This works in our test environment, but does not work when deploying the same function to our production environment. I've tried changing the redirect URL with no luck.
Also wrote a test function like this which still causes a HTTP500 (without logging an exception):
public static class RedirectTest
{
[FunctionName("RedirectTest")]
public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "RedirectTest")] HttpRequest req, ILogger log)
{
try
{
log.LogInformation("Trying to redirect");
return new RedirectResult("https://www.stackoverflow.com");
}
catch (Exception e)
{
log.LogError($"Something bad happened here: {e.Message}", e);
return new OkResult();
}
}
}
So I would think this is some settings outside the actual Function - and would appreciate tips & tricks how to go on about debugging this and get it to work.
Upvotes: 3
Views: 912
Reputation: 2848
To make this work on local machine you need to get https://github.com/Azure/azure-functions-core-tools/releases/tag/2.3.199 and this tools contains runtime 2.0.12246.0
choco install azure-functions-core-tools --version 2.3.199
Upvotes: 0
Reputation: 3925
There seems to be a bug in runtime version 2.0.12275.0
, pinning to 2.0.12246.0
works.
You can change the runtime version in Application Settings of your Function App. Just change the FUNCTIONS_EXTENSION_VERSION
key:
Upvotes: 1