Closed
Description
The L2 construct doesn't yet support IAM auth, so as a work around I had included the following code:
export class HttpIamAuthorizer implements IHttpRouteAuthorizer {
public bind(_: HttpRouteAuthorizerBindOptions): HttpRouteAuthorizerConfig {
return {
// @ts-ignore
authorizationType: 'AWS_IAM',
};
}
}
This allowed me to do an addRoutes
that looked something like this:
httpApi.addRoutes({
integration: new LambdaProxyIntegration({
handler: api.alias
}),
authorizer: new HttpIamAuthorizer(),
methods: [HttpMethod.GET],
path: '/somepath'
});
...which resulted in CloudFormation like this:
"Type": "AWS::ApiGatewayV2::Route",
"Properties": {
"ApiId": {
"Ref": "HttpApiF5A9A8A7"
},
"RouteKey": "POST /somepath",
"AuthorizationType": "AWS_IAM",
"Target": {
"Fn::Join": [
"",
[
"integrations/",
{
"Ref": "Integration"
}
]
]
}
}
When updating my CDK to the latest this no longer works due to this line of code:
Reproduction Steps
Create this class:
export class HttpIamAuthorizer implements IHttpRouteAuthorizer {
public bind(_: HttpRouteAuthorizerBindOptions): HttpRouteAuthorizerConfig {
return {
// @ts-ignore
authorizationType: 'AWS_IAM',
};
}
}
and addRoutes
like this:
httpApi.addRoutes({
integration: new LambdaProxyIntegration({
handler: api.alias
}),
authorizer: new HttpIamAuthorizer(),
methods: [HttpMethod.GET],
path: '/somepath'
});
What did you expect to happen?
Given that AWS_IAM
is valid for the L1 construct I would expect that the validation would allow it.
What actually happened?
An error is thrown, and the stack will not synth
Environment
- CDK CLI Version : 1.108.1
- Framework Version: 1.108.1
- Node.js Version: 12
- OS :
- Language (Version):
This is 🐛 Bug Report
Activity