Cannot use custom Authorization Header in AppSync when using a Lambda Authorizer

I’m using a Lambda Authorizer to authenticate AppSync requests. I think the issue I’m encountering is identical to the issue reported (and solved) for API Gateway question/bug: [API Gateway] Is the "Authorization" header intentially being set by localstack if not provided? · Issue #5770 · localstack/localstack · GitHub

When I make a curl request to AppSync without providing an Authorization header, the Lambda Authorizer receives the request containing auth header that resembles: “authorization: AWS4-HMAC-SHA256 <…>”.

When I edit the curl request to include an Authorization header, the Lambda Authorizer is instead never invoked and this error is thrown:
Error invoking AppSync authorization Lambda: An error occurred (ResourceNotFoundException) when calling the Invoke operation: Functions from 'ca-central-1' are not reachable in this region ('us-east-1')

It should be noted that I have no resources configured to be in the us-east-1 region

1 Like

Also tested the same configuration on AWS and it works

We would like to let you know that we were able to reproduce the problem, and that a fix is currently in progress that will be released in the upcoming days. We’ll let you know when a new version is available.

1 Like

Thank you!

Also not sure if its best for me to open a new issue or post here as I am having another issue related to lambda authorization in AppSync.

I return a response of the following format from the lambda authorizer:

return {
    isAuthorized: true,
    resolverContext: {
      userId: 'testUserId',

In AWS, my lambda handler that receives the request can extract the userId provided by the authorizer from event.identity.resolverContext.userId

In LocalStack though, the value of ‘identity’ is always set to {"sub":"admin"}

Here’s a link to the relevant AWS docs

Hi @RobynVG,

We’re happy to let you know that we have implemented changes that should resolve the issue you reported. Could you please update to the latest LocalStack container image and let us know whether your issue is resolved?
Thank you!

Hi Marcel!

Yes the issue I initially reported is resolved, thank you! I will move my second comment into a new thread so this one can be closed :slightly_smiling_face: