You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I migrated to new Nestjsv7
I'm using REST controller for auth and GraphQL for the other modules.
When I execute a request with REST API, it executes the DataloaderInterceptor and throws with this error:
2020-04-29T04:25:47.261Z] INFO: HANGMAN-API/23932 on x: GraphQL Playground listening on port http://localhost:8087/graphql []
(node:23932) Warning: The route option `beforeHandler` has been deprecated, use `preHandler` instead
[2020-04-29T04:25:49.245Z] ERROR: HANGMAN-API/23932 on x:
Cannot read property 'NEST_LOADER_CONTEXT_KEY' of undefined TypeError: Cannot read property 'NEST_LOADER_CONTEXT_KEY' of undefined
at DataLoaderInterceptor.intercept (/home/dantehemerson/Documents/repos/hangman-api/node_modules/nestjs-dataloader/dist/index.js:32:16)
at /home/dantehemerson/Documents/repos/hangman-api/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:22:36
at InterceptorsConsumer.intercept (/home/dantehemerson/Documents/repos/hangman-api/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:24:24)
at /home/dantehemerson/Documents/repos/hangman-api/node_modules/@nestjs/core/router/router-execution-context.js:45:60
at Object.<anonymous> (/home/dantehemerson/Documents/repos/hangman-api/node_modules/@nestjs/core/router/router-proxy.js:8:23)
at preHandlerCallback (/home/dantehemerson/Documents/repos/hangman-api/node_modules/fastify/lib/handleRequest.js:111:30)
at preValidationCallback (/home/dantehemerson/Documents/repos/hangman-api/node_modules/fastify/lib/handleRequest.js:100:5)
at handler (/home/dantehemerson/Documents/repos/hangman-api/node_modules/fastify/lib/handleRequest.js:69:5)
at handleRequest (/home/dantehemerson/Documents/repos/hangman-api/node_modules/fastify/lib/handleRequest.js:30:9)
at onRunMiddlewares (/home/dantehemerson/Documents/repos/hangman-api/node_modules/fastify/lib/middleware.js:22:5)
at Holder.done (/home/dantehemerson/Documents/repos/hangman-api/node_modules/middie/middie.js:90:9)
at SessionStrategy.strategy.pass (/home/dantehemerson/Documents/repos/hangman-api/node_modules/passport/lib/middleware/authenticate.js:343:9)
at SessionStrategy.authenticate (/home/dantehemerson/Documents/repos/hangman-api/node_modules/passport/lib/strategies/session.js:75:10)
at attempt (/home/dantehemerson/Documents/repos/hangman-api/node_modules/passport/lib/middleware/authenticate.js:366:16)
at authenticate (/home/dantehemerson/Documents/repos/hangman-api/node_modules/passport/lib/middleware/authenticate.js:367:7)
at Holder.done (/home/dantehemerson/Documents/repos/hangman-api/node_modules/middie/middie.js:112:11)
at initialize (/home/dantehemerson/Documents/repos/hangman-api/node_modules/passport/lib/middleware/initialize.js:53:5)
at Holder.done (/home/dantehemerson/Documents/repos/hangman-api/node_modules/middie/middie.js:112:11)
at internalNext (/home/dantehemerson/Documents/repos/hangman-api/node_modules/helmet/index.js:47:33)
at xXssProtection (/home/dantehemerson/Documents/repos/hangman-api/node_modules/x-xss-protection/dist/index.js:47:13)
at internalNext (/home/dantehemerson/Documents/repos/hangman-api/node_modules/helmet/index.js:51:7)
at nosniff (/home/dantehemerson/Documents/repos/hangman-api/node_modules/dont-sniff-mimetype/dist/index.js:5:9)
[2020-04-29T04:25:49.246Z] ERROR: HANGMAN-API/23932 on x: Cannot read property 'NEST_LOADER_CONTEXT_KEY' of undefined
I migrated to new Nestjsv7
I'm using REST controller for auth and GraphQL for the other modules.
When I execute a request with REST API, it executes the DataloaderInterceptor and throws with this error:
That is because here the context is undefined:
nestjs-dataloader/index.ts
Lines 45 to 47 in e254e02
If I add extra validation like this
this works. Could You help me with this error please.
Here is my repository for reproduction:
https://github.com/dantehemerson/hangman-api
The text was updated successfully, but these errors were encountered: