Closed
Description
When using @ExecutionContext() in a provider I get the error:
TypeError: Cannot read properties of undefined (reading 'getModuleContext')
at Object.getModuleContext (/Users/alexander/graphql-modules/node_modules/graphql-modules/index.js:221:23)
at ReflectiveInjector.moduleExecutionContextGetter [as _executionContextGetter] (/Users/alexander/graphql-modules/node_modules/graphql-modules/index.js:945:41)
at MyProvider.get (/Users/alexander/graphql-modules/node_modules/graphql-modules/index.js:660:41)
at MyProvider.<anonymous> (/Users/alexander/graphql-modules/src/module.ts:9:22)
at Generator.next (<anonymous>)
at /Users/alexander/graphql-modules/src/module.ts:17:71
at new Promise (<anonymous>)
at __awaiter (/Users/alexander/graphql-modules/src/module.ts:13:12)
at MyProvider.create (/Users/alexander/graphql-modules/src/module.ts:25:16)
at hello (/Users/alexander/graphql-modules/src/module.ts:27:30),
[Symbol(async_id_symbol)]: 75,
[Symbol(trigger_async_id_symbol)]: 74
To Reproduce
Steps to reproduce the behavior:
Check out the codesandbox to see the error: https://codesandbox.io/s/graphql-modules-jxwdrv?file=/src/module.ts
- open a terminal
- run
npm start
- open https://....io/graphql
- run query
{ hello }
Expected behavior
Context should be available in provider.
Environment:
graphql-modules
: 2.1.0- NodeJS: 18.7.0
Additional context
To me the problem seems to be that async_hooks.executionAsyncId()
returns a different id in executionContext.getModuleContext than in executionContext.create.
Metadata
Metadata
Assignees
Labels
No labels