question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Schema must contain uniquely named types but contains multiple types named "EmailObject".

See original GitHub issue

Hello. There is an error while running api-admin service regarding the EmailObject type. Any possible fixes ?

(node:3244) UnhandledPromiseRejectionWarning: Error: Schema must contain uniquely named types but contains multiple types named "EmailObject".
    at new GraphQLSchema (C:\Users\msi4\apps\ultimate-backend\node_modules\graphql\type\schema.js:194:15)
    at GraphQLSchemaFactory.<anonymous> (C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\dist\schema-builder\graphql-schema.factory.js:41:32)
    at Generator.next (<anonymous>)
    at C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\node_modules\tslib\tslib.js:114:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\node_modules\tslib\tslib.js:110:16)
    at GraphQLSchemaFactory.create (C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\dist\schema-builder\graphql-schema.factory.js:30:28)
    at GraphQLSchemaBuilder.<anonymous> (C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\dist\graphql-schema.builder.js:57:60)
    at Generator.next (<anonymous>)
    at C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\node_modules\tslib\tslib.js:114:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\node_modules\tslib\tslib.js:110:16)
    at GraphQLSchemaBuilder.buildSchema (C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\dist\graphql-schema.builder.js:56:28)
    at GraphQLSchemaBuilder.<anonymous> (C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\dist\graphql-schema.builder.js:26:39)
    at Generator.next (<anonymous>)
    at C:\Users\msi4\apps\ultimate-backend\node_modules\@nestjs\graphql\node_modules\tslib\tslib.js:114:75
(node:3244) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:3244) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Relevant issues https://github.com/MichalLytek/type-graphql/issues/396 https://github.com/nestjs/graphql/issues/721

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
juicycleffcommented, Jun 19, 2020

Done 😃

1reaction
dayrimcommented, Jun 18, 2020

Found it ! 😄 Turned out very simple. There are duplicate GraphQLModule imports.

import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { CookieSerializer } from '@ultimatebackend/common';
import { CoreModule, RolesRpcClientService, ServiceRegistryModule } from '@ultimatebackend/core';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { RolesModule } from './roles/roles.module';
import { AccountsModule } from './accounts/accounts.module';
import { TenantsModule } from './tenants/tenants.module';
import { WebhooksModule } from './webhooks/webhooks.module';
import { BillingsModule } from './billings/billings.module';
import { CardsModule } from './cards/cards.module';
import { PlansModule } from './plans/plans.module';
import { NotificationsModule } from './notifications/notifications.module';
import { UsersModule } from './users/users.module';
import { TenantMembersModule } from './tenant-members/tenant-members.module';
import { GqlConfigService } from './gql-config.service';
import { AccessTokenModule } from './access-token/access-token.module';
import { GlobalClientModule } from './common/global-client.module';

@Module({
  imports: [
    ServiceRegistryModule,
    GraphQLModule.forRootAsync({
      useClass: GqlConfigService,
    }),
    GraphQLModule.forRootAsync({
      useClass: GqlConfigService,
    }),
    GlobalClientModule,
    CoreModule,
    RolesModule,
    AccountsModule,
    TenantsModule,
    WebhooksModule,
    BillingsModule,
    CardsModule,
    PlansModule,
    NotificationsModule,
    UsersModule,
    TenantMembersModule,
    AccessTokenModule,
  ],
  controllers: [AppController],
  providers: [AppService, CookieSerializer, RolesRpcClientService],
})
export class AppModule {}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "Schema must contain uniquely named types but ...
Hello, I have the following schema: @ObjectType() class Action { @Field(type => Skill, { nullable: true }) skill?
Read more >
Error: Schema must contain uniquely named types but ...
This error usually occurs if you have named two or more of your Object Types with the same name . For example,
Read more >
Error: Schema must contain uniquely named types but ...
Hello, see GitHub issue here: Error: Schema must contain uniquely named types but contains multiple types named "DateTime".
Read more >
Error: Schema Must Contain Uniquely Named ... - ADocLib
A GraphQL object type has a name and fields but at some point those fields have to resolve to some concrete data.That's where...
Read more >
Oracle® SQL Developer - Data Modeler User's Guide
Derivative Works shall not include works that remain separable from, or merely link (or ... The data types model in Data Modeler combines...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found