Hi, Newbie here,
I’m configuring a serverless typescript service using the aws-nodejs-typescript boilerplate. The documentation shows that you can create a cognito userpool as a resource and supply that as the authorizer for a function.
Docs:
functions:
create:
handler: posts.create
events:
- http:
path: posts/create
method: post
integration: lambda
authorizer:
name: MyAuthorizer
type: COGNITO_USER_POOLS
arn:
Fn::GetAtt:
- CognitoUserPool
- Arn
---
resources:
Resources:
CognitoUserPool:
Type: 'AWS::Cognito::UserPool'
Properties: ...
My typescript:
functions: {
create_admin_user : {
handler: '/handler.adminIndex',
events : [
{
http : {
method: 'post',
path: 'user/admin',
cors : true,
authorizer :{
name : "MyCognitoUserPool",
type: 'COGNITO_USER_POOLS',
arn: {"Fn::GetAtt" : ["CognitoUserPool","Arn"]}
}
}
}
]
}
},
resources: {
Resources : {
CognitoUserPool: {
Type: "AWS::Cognito::UserPool",
Properties : ....
}
}
}
In the IDE (VSCode) I get an error: Type ‘{ “Fn::GetAtt”: string[]; }’ is not assignable to type ‘string’.
And thus it fails to deploy. Can anyone provide some insight. I’ve seen forums where this is the accepted solution. Is this a typescript issue? And if so, can anyone suggest a suitable workaround?