Hi! I'm using the sst.ApiAuthorizationType.AWS_IAM...
# sst
o
Hi! I'm using the sst.ApiAuthorizationType.AWS_IAM auth with Typescript and the requestContext.authorizer.iam property is missing from the APIGatewayProxyEventV2 interface. Just jwt is declared. Should I open a GitHub issue with this?
a
Do you mean on the type?
The type only has JWT.
But this is a problem with @types library.
If you log the object, isn’t the object there?
I had the same problem with lambda-authorizer.
o
yes the object is there but the type interface doesn't declare it so the linter gives me an error
event.requestContext.authorizer?.iam. Property 'iam' does not exist on type
a
Yep.
Same problem to me.
This is NOT related to SST at all.
This is the type definition which is wrong.
You should report an issue on the Types library, I did already 3 weeks ago but no luck.
Can you please also report it? I did it for
lambda
authorizer, but looks like
iam
is also unsupported.
o
oh I see thank you do you have the link to the issue so I can give a thumbs up?
a
I think I loaded it wrong because is not showing in the issues list,
o
ok I will create an issue there thank you
a
Let me know once created please.
I can add the
lambda
authorizer to it also.
Due this type is not well defined, is missing lot of things.
o
The problem is that AWS doesn't have this defined in the payload object https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
a
But the response has it, right?
o
yes
a
So I don’t get it.
This payload might be incomplete.
In the aws doc.
o
I don't get it either
a
Also, in the types library found some issues related to this.
Did you look there?
In that repo.
o
yes but they said that if this is not in the documentation of AWS they can't do nothing. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/50939
a
😞
We are on this together man @Olivers.
You will need to put
event.requestContext.authorizer?.iam!
The
!
which is not good.
Also, I think I’m using v1 event.
To acomplish this.
I had to use Event v1, which is called
APIGatewayEvent
and this:
const authorizer = event.requestContext.authorizer!.lambda;
Or maybe we can create a custom type?
o
for now I'm using // @ts-ignore
f
Hey are you guys in the “AWS Developers” slack? Maybe it’s worth bringing it up in there.
Let me know and I can send you guys an invite.
o
Hi @Frank no I'm not in the AWS Developers slack it would be great if you can send me an invitation
f
Yup submitted an invite request for ur @symlab.io email.
a
@Frank can you invite me please?
@Olivers can you tell me how to use the ignore?
o
@Adrián Mouly just put that line // @ts-ignore above the code that you want the linter to ignore and that's all
@Frank great
f
@Adrián Mouly submitted invite request to ur @mouly.ar email
a
Thank youuu.
@Olivers we can not use @ts-ignore
Copy code
51:9  error  Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
😞
SST doesn’t like it.
f
@Adrián Mouly You can disable the
@typescript-eslint/ban-ts-comment
lint rule by adding it ur
.eslintrc.json
- https://docs.serverless-stack.com/working-locally#linting--type-checking
a
Yeah, but I like default config. 😞
There is not nice solution until AWS fixes the types.
@Olivers did you send a message on AWS Developers already?
o
no not yet @Adrián Mouly