typescriptgraphqlnestjsgraphql-playgroundgraphql-federation

GraphQL Playground bootloop (Nestjs)


I am trying to use the GQL Playground. I've join a team that has never used it up until now, and whenever I hit http://localhost:8001/graphql , I can see the GQL Playground loading logo, but it's bootlooping.

I can see they are using GQL Federation (but I have no clue how it works) :

GraphQLFederationModule.forRoot({
      typePaths: ['**/*.graphql'],
      context: ({ req }) => ({
        req,
        loggedUserId: req.headers['x-user-id'],
        membersByGroupLoader: membersByGroupLoader(),
        groupsLoader: groupsLoader(),
        viewsByGroupLoader: viewsByGroupLoader(),
        customFieldLoader: customFieldLoader(),
        customFieldUserByContactsLoader: customFieldUserByContactsLoader(),
        customFieldContactByContactsLoader: customFieldContactByContactsLoader(),
      }),

And if I try to add the following GraphQLModule, the app crashes :

GraphQLModule.forRoot({
      debug: false,
      playground: true,
    }),

I have a Docker configuration. It might interferes but I am not sure.

How can I manage to get the GQL Playground working ?


Solution

  • I finally solved this by adding this helmet configuration :

    app.use(
      helmet({
        contentSecurityPolicy:
          process.env.NODE_ENV === 'production' ? undefined : false,
      }),
    );