#Have a trouble with cors in GraphQL playground

3 messages · Page 1 of 1 (latest)

modern goblet
#

When i try to open the playground, I see this exception. Cors was enabled

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.enableCors();
  await app.listen(3000);
}
bootstrap();

GraphQl config

export = <GqlModuleOptions>{
  driver: ApolloDriver,
  context: ({ req, connection }) => {
    if (connection) {
      return { req: { headers: connection.context } };
    }
    return { req };
  },
  autoSchemaFile: true,
  installSubscriptionHandlers: true,
  playground: true,
  introspection: true,
  plugins: [logPlugin],
};
lavish raven
#

The error is about CSRF, not CORS. That said, I have never seen that kind of error. Is that the whole setup you have in the application?

modern goblet