I followed the Apollo Getting Started example in a Github Codespace.
Upon starting the server, I see the error:
{
"error": "Preflight response is not successful"
}
Sample repo to reproduce is here: https://github.com/anishkny/codespaces-test
I tried various options for cors
but it did not work:
...
new ApolloServer({ typeDefs, resolvers
cors: {
"origin": "*",
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
"preflightContinue": false,
"optionsSuccessStatus": 204
}
});
...
I had this same issue. It turns out that Playground is not forwarding your Github credentials. Notice that if you visit the preview URL in an incognito window, you are redirected to the Github login screen. The solution is to change Playground settings so that your credentials are sent in GraphQL requests.