Graphql: Error when run e2e-tests

Created on 5 Sep 2018  路  7Comments  路  Source: nestjs/graphql

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior


Error when run e2e-tests:

TypeError: this.httpServer.getInstance is not a function

      at GraphQLModule.<anonymous> (node_modules/@nestjs/graphql/dist/graphql.module.js:91:41)
      at node_modules/@nestjs/graphql/dist/graphql.module.js:19:71
      at Object.<anonymous>.__awaiter (node_modules/@nestjs/graphql/dist/graphql.module.js:15:12)
      at GraphQLModule.onModuleInit (node_modules/@nestjs/graphql/dist/graphql.module.js:89:16)
      at NestApplication.callModuleInitHook (node_modules/@nestjs/core/nest-application-context.js:66:39)

Expected behavior


No error

Minimal reproduction of the problem with instructions

  1. git clone [email protected]:krivochenko/graphql-testing.git
  2. npm i
  3. npm run start (just for ensure that app works)
  4. npm run test

Environment


Nest version: 5.3.2


For Tooling issues:
- Node version: 10.1.0
- Platform:  Windows
potential issue

Most helpful comment

Fixed in 5.2.0. Ensure to update Nest packages (core, common) as well.

All 7 comments

youp same for me
Env:
node -v v10.9.0
osx
npm -v 6.2.0

deps

"@nestjs/common": "^5.3.2",
    "@nestjs/core": "^5.3.3",
    "@nestjs/graphql": "^5.1.1",
    "@nestjs/microservices": "^5.3.2",
    "@nestjs/typeorm": "^5.2.0",
    "@nestjs/websockets": "^5.3.1",
    "apollo-link-ws": "^1.0.8",
    "apollo-server": "^2.0.6",
    "apollo-server-express": "^2.0.5",
    "graphql": "^14.0.0",
    "graphql-subscriptions": "^0.5.8",
    "graphql-tools": "^3.1.1",

I can copy that. If you add the GraphQL Module

GraphQLModule.forRoot({
      typePaths: ['./**/*.graphql']
 })

the e2e tests will fail. If you comment out those three lines it works.

Update:
So in the end within the GraphQL Module the injected HttpServer is an empty object.

constructor(
    @Inject(HTTP_SERVER_REF) private httpServer: HttpServer,
    @Inject(GRAPHQL_MODULE_OPTIONS) private readonly options: GqlModuleOptions,
    private readonly graphQLFactory: GraphQLFactory,
) {}

exact same situation here

I added a e2e test to nest graphql appolo sample to help

It can now be reproduced here https://github.com/cyril-lakech/nest/tree/test/e2eGraphQL/sample/12-graphql-apollo

Fixed in 5.2.0. Ensure to update Nest packages (core, common) as well.

Thanks you so much

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fenos picture fenos  路  5Comments

Warchant picture Warchant  路  4Comments

galkin picture galkin  路  4Comments

rkutca picture rkutca  路  3Comments

zhenwenc picture zhenwenc  路  4Comments