Alexis Levasseur
03/31/2022, 2:06 PMcors: true,
defaultAuthorizationType: ApiAuthorizationType.AWS_IAM,
The problem is that I need to add a route that calls into a lambda in order to handle the preflight calls.
'OPTIONS /{proxy+}': {
function: 'src/functions/api/options.main',
authorizationType: ApiAuthorizationType.NONE,
},
The lambda simply returns the proper headers:
return {
statusCode: 204,
body: '',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': '*',
'Access-Control-Allow-Headers': '*',
},
};
It does work, but I hate the fact that I need to manage my own lambda to do CORS.
Anyone here got it working without having to go through all this? I suppose there is a way to add a route to the sst.API without specifying an integration right? (I can do that using the console)
Any help would be greatly appreciated.Derek Kershner
03/31/2022, 10:07 PMsst.API
should not require any CORS whatsoever from routes, HTTP API
handles this all on it’s own.Derek Kershner
03/31/2022, 10:08 PMOPTIONS
route anywhere.Alexis Levasseur
03/31/2022, 10:09 PMDerek Kershner
03/31/2022, 10:09 PMAlexis Levasseur
03/31/2022, 10:10 PMDerek Kershner
03/31/2022, 10:11 PMAlexis Levasseur
03/31/2022, 10:11 PMDerek Kershner
03/31/2022, 10:11 PMAlexis Levasseur
03/31/2022, 10:12 PMDerek Kershner
03/31/2022, 10:13 PMAlexis Levasseur
03/31/2022, 10:14 PMAlexis Levasseur
03/31/2022, 10:14 PMDerek Kershner
03/31/2022, 10:15 PMAlexis Levasseur
03/31/2022, 10:15 PMAlexis Levasseur
03/31/2022, 10:16 PMAlexis Levasseur
03/31/2022, 10:16 PMDerek Kershner
03/31/2022, 10:18 PMDerek Kershner
03/31/2022, 10:19 PMAlexis Levasseur
03/31/2022, 10:19 PMAlexis Levasseur
03/31/2022, 10:20 PMAlexis Levasseur
03/31/2022, 10:20 PMAlexis Levasseur
03/31/2022, 10:20 PMDerek Kershner
03/31/2022, 10:21 PMDerek Kershner
03/31/2022, 10:22 PMSSM
, then put them into the authorizer directly, and hand in other stuff as environment variables in CDK.Derek Kershner
03/31/2022, 10:22 PMAlexis Levasseur
03/31/2022, 10:27 PM