Other question/concern… Is anybody using “Simple” ...
# sst
a
Other question/concern… Is anybody using “Simple” Lambda Authorizer? It works fine for the most part, but this is strange… On my lambda integration, this is what I receive on the `event`:
Copy code
...
requestContext: {
    accountId: 'xxx',
    apiId: 'xxx',
    authorizer: { lambda: [Object] },
    domainName: 'xxx',
...
As you can see, there is an object
authorizer
which has a child `lambda`… the object inside
lambda
it’s totally fine, it’s exactly what I expect to receive. The problem is, apparently this
lambda
object doesn’t exists on TS interface
APIGatewayProxyEventV2
. As you can see here, this is the interface definition:
Copy code
...
    requestContext: {
        accountId: string;
        apiId: string;
        authorizer?: {
            jwt: {
                claims: { [name: string]: string | number | boolean | string[] };
                scopes: string[];
            };
        } | undefined;
        domainName: string;
        domainPrefix: string;
...
Apparently the interface
APIGatewayProxyEventV2
only supports
jwt
, but not
lambda
? anybody else had this issue?
t
Hm that's annnoying. I think AWS says this is the official format as you can see here: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
Maybe they're trying to get everyone to use JWT only (it's what I use)
Any reason why you're using the simple lambda auth?
a
Well, the JWT authorizer doesn’t work for me.
The logic specified there doesn’t work for my token.
And also, I have to do some extra logic, for example, the jwt is missing some parameters that I have to get from other system.
I need some flexibility, my JWT is coming from a legacy PHP platform, there is no proper “identity provider”.
t
ah got it
a
@thdxr I been checking this again, apparently the type is missing on
@types
.
In this lib:
@types/aws-lambda
.
So AWS supports custom authorizer, but the type is not defined properly.
Any idea how I can solve this? maybe defining my own type?
t
Yeah I did check the underlying library
And it doesn't have it defined
a
Mmm.
Bue the value is populated.
I mean it works for me.
But the type fails.
t
Yeah it's just a type issue. I'd suggest making your own type
a
Ok cool.