Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins not working in nestjs #3383

Open
SOG-web opened this issue Jul 24, 2024 · 1 comment
Open

Plugins not working in nestjs #3383

SOG-web opened this issue Jul 24, 2024 · 1 comment

Comments

@SOG-web
Copy link

SOG-web commented Jul 24, 2024

Describe the bug

 GraphQLModule.forRoot<YogaDriverConfig>({
      driver: YogaDriver,
      autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
      sortSchema: true,
      logging: 'debug',
      landingPage: false,
      // graphiql: false,
      healthCheckEndpoint: '/live',
      context: ({ req, res }) => ({ req, res }),
      plugins: [
        useSofa({
          basePath: '/rest',
          swaggerUI: {
            endpoint: '/swagger',
            spec: {
              info: {
                title: 'My API',
                version: '1.0.0',
                description: 'This is a sample API',
              },
            },
          },
        }),
        useReadinessCheck({
          endpoint: '/ready', // default
          check: async () => {
            try {
              // await checkDbAvailable();
              // if true, respond with 200 OK
              return true;
            } catch (err) {
              // log the error on the server for debugging purposes
              console.error(err);
              // if false, respond with 503 Service Unavailable and no bdy
              return false;
            }
          },
        }),
        useExecutionCancellation(),
        useCSRFPrevention({
          requestHeaders: ['x-graphql-yoga-csrf'], // default
        }),
        useResponseCache({
          // global cache
          session: () => null,
          cache,
        }),
        useAPQ(),
      ],
    }),

/live not working
/swagger not working
/rest not working
/ready not working

Your Example Website or App

https://github.com/SOG-web/yoga-nestjs

Steps to Reproduce the Bug or Issue

just set up a simple code first gql nestjs server

Expected behavior

those endpoint should be working

Screenshots or Videos

No response

Platform

  • OS: macOS
  • NodeJS: 20+
  • "@graphql-yoga/nestjs": "^3.6.1"

Additional context

No response

@greenGizmo
Copy link

Same problem here. Trying to use customEnvelop plugins and the useJWT plugin which work perfectly fine in Mesh but not in NestJS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants