Brinsley
04/26/2022, 10:21 AMnew Api(this, "api", {
authorizers: {
"custom-auth": {
type: "lambda",
function: Function.fromFunctionArn(this, "custom-auth", "my-lambda-arn"),
}
}
});
This gives me an error:
Type 'IFunction' is missing the following properties from type 'Function': _isLiveDevEnabled, localId, attachPermissions, getConstructMetadata, and 33 more.
So I guess I should actually be using the cdk.authorizer
with a HttpLAmbdaAuthorizer
construct instead? (seem to have lost where to import that class from 😞)Brinsley
04/26/2022, 11:31 AMnew Api(this, "api", {
authorizers: {
"custom-auth": {
type: "lambda",
cdk: {
authorizer: new HttpLambdaAuthorizer("authorizer", Function.fromFunctionArn(this, "custom-auth", "my-lambda-arn"))
}
}
}
});
I thought I saw someone mentionthat we shouldn't need to import the authorizer package going forward? Or did make that up?Brinsley
04/26/2022, 11:41 AMFunction.fromFunctionArn
is incompatible with the SST properties. Is this an oversight, intended behaviour or a bug?Brinsley
04/26/2022, 1:06 PMthdxr
04/26/2022, 1:32 PMthdxr
04/26/2022, 1:33 PMFunction.fromFunctionArn
? This won't work since it's expecting an sst.Functionthdxr
04/26/2022, 1:33 PMBrinsley
04/26/2022, 1:37 PMBrinsley
04/26/2022, 1:40 PMHttpLambdaAuthorizer
as mentioned above, but I'll definitely have this issue for getting my API to call a lambda declared elsewhere. Might just have to declare a function in the local project that has permissions to call the required external lambda.thdxr
04/26/2022, 1:40 PMBrinsley
04/26/2022, 1:41 PMBrinsley
04/26/2022, 1:42 PMFrank
lambda.Function
for API routes.Frank
Frank
Brinsley
04/28/2022, 5:38 AM