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

Matthew Sykes 116 Reputation points
2021-08-04T08:21:24.433+00:00

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 Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,978 questions
Azure Queue Storage
Azure Queue Storage
An Azure service that provides messaging queues in the cloud.
105 questions
0 comments No comments
{count} votes

Accepted answer
  1. Matthew Sykes 116 Reputation points
    2021-08-04T09:17:45.243+00:00

    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!

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.