getCurrentUser not called on serverless deploy

Our redwood project uses a custom authentication mechanism using bearer tokens. The project is deployed on AWS Lambda through a serverless deploy.

We’ve gotten custom authentication working locally, but authentication fails on the lambda deploy since getCurrentUser isn’t called. CloudWatch logs confirm that the getCurrentUser function was never called during the authentication flow.

Any way we can debug this to resolve this issue? Not sure if we’re missing anything

FYI: we’ve followed the steps mentioned here to get auth working locally: Custom github JWT Auth with Redwood Auth - #25 by edjiang


Hi @rushil - have you tried

This approach will allow you to get the current user …

import type { APIGatewayEvent, Context } from 'aws-lambda'

import { useRequireAuth } from '@redwoodjs/graphql-server'

import { getCurrentUser, isAuthenticated } from 'src/lib/auth'
import { logger } from 'src/lib/logger'

const myHandler = async (event: APIGatewayEvent, context: Context) => {'Invoked myHandler')

  if (isAuthenticated()) {'Access myHandler as authenticated user')

    return {
      statusCode: 200,
      headers: {
        'Content-Type': 'application/json',
      body: JSON.stringify({
        data: 'myHandler function',
  } else {
    logger.error('Access to myHandler was denied')

    return {
      statusCode: 401,

export const handler = useRequireAuth({
  handlerFn: myHandler,

@dthyresson : yep, we had already tried that. We finally just got it working and turns out it had something to do with auth-provider header being in lower case. We initially had the first letters capitalized.

Fixed now, problem solved. Thanks so much for pointing us in the right direction. Much appreciated!

1 Like