0

I have an azure function app that I have containerized and running in AKS. One of my http endpoints has a query string parameter of code=. When I call that endpoint I immediately get a 500 response. To rule out anything in the code I only return a 400 just to validate that I am executing the code. The strange thing is that if I change the query string parameter to anything other that code, for example codeg, I get back the proper 400 response.

I've enabled debug logging and I am getting a route match so I know the call is getting to the function app. However I am getting no other logs to indicate what might be failing.

tanzencoder
  • 67
  • 1
  • 8

1 Answers1

1

It may be throwing an error because it's expecting the function key to be in the code query parameter.

I'm assuming you have a function key securing the endpoint?

Try sending the function key in the header x-functions-key which should free up the code query parameter for your use.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=csharp#api-key-authorization

Chris
  • 3,113
  • 5
  • 24
  • 46
  • Brilliant find thank you. Even though this is an anonymous function I didn't think about that. What threw me was that it works locally using localhost in the container running the same image that we deployed to the cluster Given that it is anonymous how can we work around that? This endpoint is used for authentication callback and I don't know how much control we have over those parameters. – tanzencoder Jul 14 '21 at 21:21
  • Still don't know the ultimate reason why an anonymous function should care about those parameters but I found it had to do with a permissions issue on the Secrets directory. Details and a work-around can be found here https://stackoverflow.com/questions/68411649/why-does-an-anonymous-httptrigger-azure-function-throw-a-500-internal-server-err/68469479#68469479 – tanzencoder Jul 21 '21 at 12:30