question

MatthewSykes-8744 avatar image
0 Votes"
MatthewSykes-8744 asked MatthewSykes-8744 answered

Azure Queue Triggered Function - The given key '$request' was not present in the dictionary.

I have a function app running in Azure, most functions are HTTP triggers and work fine but I also have 3 or 4 queue based triggers.

About a week ago these functions stopped working, when the queue receives an item it is correctly triggering the function, however it is immediately throwing;

The given key '$request' was not present in the dictionary.


I am really stumped on to what is causing this so any advice would be much appreciated.

azure-functionsazure-queue-storage
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MatthewSykes-8744 avatar image
0 Votes"
MatthewSykes-8744 answered

So, this ones my fault, and a rather obvious problem once I realised.

The function app HTTP endpoints use Azure AD authentication, with each function being injected with the 'ClaimsPrincipal' in the constructor.

I had made a change to the queue triggers to also expect this ClaimsPrincipal, which doesn't exist on a queue triggered function.

So in short, don't try to pull user context or claims from a queue triggered function and you will be fine. Also a slap on the wrist for not testing properly!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.