sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.08k stars 126 forks source link

Non unique JWT authorizer ids are generated with multiple APIGatewayV2 #470

Closed wickedst closed 1 month ago

wickedst commented 1 month ago

This configuration

const auth = {
  jwt: {
    audiences: [userPoolClient.id],
    issuer: $interpolate`https://cognito-idp.${aws.getArnOutput(userPool).region}.amazonaws.com/${userPool.id}`,
  },
};

const apiOne = new sst.aws.ApiGatewayV2("ApiOne");
apiOne.route("GET /{proxy+}", "./packages/api/one.handler", { auth });
apiOne.route("POST /{proxy+}", "./packages/api/one.handler", { auth });

const apiTwo = new sst.aws.ApiGatewayV2("ApiTwo");
apiTwo.route("GET /{proxy+}", "./packages/api/two.handler", { auth });
apiTwo.route("POST /{proxy+}", "./packages/api/two.handler", { auth });

...yields the following error

|  StatusCode: 400, RequestID: 813b57b5-9d8c-43da-bee3-c374b7cae7d7, BadRequestException: Invalid authorizer ID specified. Setting the authorization type to JWT requires a valid JWT authorizer.jjjjj
wickedst commented 1 month ago

https://github.com/sst/ion/pull/471