Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom authorizers return 403 "No principalId set on the Response" #1341

Closed
jega-ms opened this issue Feb 20, 2022 · 1 comment · Fixed by #1600
Closed

Custom authorizers return 403 "No principalId set on the Response" #1341

jega-ms opened this issue Feb 20, 2022 · 1 comment · Fixed by #1600

Comments

@jega-ms
Copy link

jega-ms commented Feb 20, 2022

Bug Report

Custom authorizers return 403 error even after enabling simple response ( "enableSimpleResponses: true")

Current Behavior

{"statusCode":403,"error":"Forbidden","message":"No principalId set on the Response"}

Sample Code

  • file: serverless.yml
service: my-service

plugins:
  - serverless-webpack
  - serverless-offline
  - serverless-dynamodb-local
  - serverless-api-compression
  - 
provider:
  runtime: nodejs14.x
  stage: dev
    authorizers:
      firebaseAuth:
        type: request
        identitySource: $request.header.Authorization
        resultTtlInSeconds: 300
        enableSimpleResponses: true
        payloadVersion: "2.0"
        functionName: firebaseAuth
        
functions:
  hello:
    events:
      - http:
          method: get
          path: hello
    handler: handler.hello
  • file: handler.js
'use strict'

const { stringify } = JSON
export const authorize = async function (event: any): Promise<APIGatewaySimpleAuthorizerResult> {
   return { isAuthorized: true };
}

Expected behavior/code

Request should not fail with 403 error

Environment

  • serverless version: [e.g. v3.2.0]
  • serverless-offline version: [e.g. v8.5.0]
  • node.js version: [e.g. v17.5.0]
  • OS: [ darwin, node 17.5.0, framework 3.2.1 (local) 3.2.0v (global), plugin 6.1.0, SDK 4.3.1]
@vidueirof
Copy link

vidueirof commented Jul 5, 2022

It's related to #1475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants