colin
07/22/2021, 6:04 PMApolloApi
to allow for CORS requests while being authenticated by Cognito Pool? The Apollo API seems to be failing on the preflight OPTIONS
request. If I add an OPTIONS route manually to the ApiGateway with no authorization, the calls succeed and I can make graphql queries. But I’m not sure how to configure the route from the ApolloApi
level as the routes
param is disabled…
It seems that when the Apollo API is created with a UserPoolAuthorizer, it authenticates on all routes/http methods including OPTIONS which according to the CORS spec should not have auth headers. Trying to find a way to disable that without manually updating the gateway.
Any thoughts here?
// current config
const api = new sst.ApolloApi(this, 'apollo-v2', {
server: 'src/index.handler',
defaultAuthorizationType: sst.ApiAuthorizationType.JWT,
defaultAuthorizer: new HttpUserPoolAuthorizer({
userPool,
userPoolClient,
}),
cors: {
allowOrigins: ['localhost:3000'],
allowHeaders: ['*'],
allowMethods: [CorsHttpMethod.ANY],
allowCredentials: true,
},
})
Frank
Frank
Frank
Frank
Frank
OPTIONS
route manually created in the APIG console.Frank
colin
07/23/2021, 1:09 PMcolin
07/23/2021, 1:09 PM