Hi Guys,
I am trying to use custom authorizer in my serverless project. i created two projects one for the services and one for the authorizer. i deployed both in aws and i can see the functions go tcreated.
below is yml code for one of the function
getAuthenticatorsList:
handler: src/routes/auth.handler
events:
- http:
method: get
path: /authenticators
cors: ${self:custom.cors}
authorizer:
arn: ${file(./variables/${self:provider.stage}-${self:provider.region}.yml):AUTHORIZER_ARN}
managedExternally: false
resultTtlInSeconds: 0
identitySource: method.request.header.Authorization
When i hit from postman /authenticators I can see only the authorizer function is getting called ( i see only cloudwatch logs for authorizer ). when i check logs its returning proper token.
but when i see the getAuthenticatorsList cloudwatch logs i am not seeing anything - empty records.
in postman i see { message: null } - 500 error.
Did anyone faced this and need help to fix this issue.
serverless": “^3.39.0”
Did you check the Lambda’s logs, as it sounds like the authorizer is working ?
Yes, I can see only logs for the authorizer but not in the getAuthenticatorsList lamda.
before calling the getAuthenticatorsList it will call authorizer first and based on the response it should call the getAuthenticatorsList lamda which is not happing. eith i will return message : unauthorize if we give wrong token or if proper token is provided i can see the authorizer lamda prints all the logs with success response but on post man i see message:null with 500
And does the code run without the authorizer ?
Yes. without the authorizer the getAuthenticatorsList works fine without any error.