Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nest.js Error: Only one plugin can implement renderLandingPage

I`m using nest.js graphql prisma.
When I run the npm run start:dev command, I get the following error.

error

/node_modules/apollo-server-core/src/ApolloServer.ts:471 throw Error('Only one plugin can implement renderLandingPage.'); ^ Error: Only one plugin can implement renderLandingPage.

app.module.ts
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ApolloServerPluginLandingPageLocalDefault } from 'apollo-server-core';
import { DonationsModule } from './donations/donations.module';
import { ApolloDriverConfig, ApolloDriver } from '@nestjs/apollo';

@Module({
  imports: [
    GraphQLModule.forRoot<ApolloDriverConfig>({
      driver: ApolloDriver,
      plugins: [ApolloServerPluginLandingPageLocalDefault()],
      typePaths: ['./**/*.graphql'],
    }),
    DonationsModule,
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

like image 982
yuturo Avatar asked Dec 01 '25 03:12

yuturo


1 Answers

As per NestJs Docs:

To use Apollo Sandbox instead of the graphql-playground as a GraphQL IDE for local development, use the following configuration:

So you must insert inside the .forRoot({}) code the following element: playground: false,.

So your code will be:

app.module.ts
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ApolloServerPluginLandingPageLocalDefault } from 'apollo-server-core';
import { DonationsModule } from './donations/donations.module';
import { ApolloDriverConfig, ApolloDriver } from '@nestjs/apollo';

@Module({
  imports: [
    GraphQLModule.forRoot<ApolloDriverConfig>({
      driver: ApolloDriver,
      playground: false, // this line is the only change in your code
      plugins: [ApolloServerPluginLandingPageLocalDefault()],
      typePaths: ['./**/*.graphql'],
    }),
    DonationsModule,
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
like image 157
air_ioannis Avatar answered Dec 04 '25 03:12

air_ioannis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!