When moving from Serverless framework to SST the `...
# sst
j
When moving from Serverless framework to SST the
event.requestContext.authorizer.*
becomes
event.requestContext.authorizer.lambda.*
when using a
ApiAuthorizationType.CUSTOM
- is this due to payloadFormatVersion - and is there a way round it? @Frank
t
let me take a look
Yep so there's an option we expose on the api called
defaultPayloadFormatVersion
Copy code
new Api(stack, "Api", {
    defaultPayloadFormatVersion: ApiPayloadFormatVersion.V1,
  });
Curious - are you using typescript at all?
a
I have this problem.
This because you are using V2.
V1 and V2 are totally different authorizer schema.
And also,
lambda
is not defined in Types, so you are going to get errors.
@Jack Fraser you have to decide if continue using GW v1 or move to GW v2.
j
What is the benefit of v2? Or it just payload structure has changed?
t
it's cooler
a
Is just cooler.
Don’t ask me why.
😂
t
haha
a
Nah give it a try.
t
I don't think there's any advantage afaik but AWS seems to be trying to push people towards it so I wouldn't fight them for too long
a
It has more features.
t
ah
a
And also the Console UI is 1000% better.
It has integrations, v1 didn’t have that.
Or it has, but differently.
I’ve found v2 way more easy to understand, from Console and code.
V1 sucks, never got it to work properly.
j
Is there type support?
All our code is v1 at present. So fairly big change.
a
Type support is there, but not for custom authorizer.
😞
All the other yes.