Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e test fails with "No context available. ns.run() or ns.bind() must be called first." #342

Open
topchyalexey opened this issue Dec 12, 2023 · 1 comment

Comments

@topchyalexey
Copy link

Environment: node 16, macos

Fails just third of three cases

[Nest] 66636  - 12/12/2023, 1:14:55 PM   ERROR [ExceptionsHandler] No context available. ns.run() or ns.bind() must be called first.
Error: No context available. ns.run() or ns.bind() must be called first.
    at Namespace.set (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/cls-hooked/context.js:36:11)
    at setValue (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/express-ctx/dist/index.js:12:9)
    at Function.set (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/src/providers/context.provider.ts:14:36)
    at Function.setAuthUser (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/src/providers/context.provider.ts:20:25)
    at AuthUserInterceptor.intercept (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/src/interceptors/auth-user-interceptor.service.ts:11:37)
    at nextFn (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:23:36)
    at Object.handle (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:21:48)
    at I18nLanguageInterceptor.intercept (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/nestjs-i18n/src/interceptors/i18n-language.interceptor.ts:44:19)
    at nextFn (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:23:36)
    at /Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:25:40
    at Observable._subscribe (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/observable/defer.ts:55:15)
    at Observable.Object.<anonymous>.Observable._trySubscribe (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/Observable.ts:244:19)
    at /Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/Observable.ts:234:18
    at Object.errorContext (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/util/errorContext.ts:29:5)
    at Observable.Object.<anonymous>.Observable.subscribe (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/Observable.ts:220:5)
    at Object.mergeInternals (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/operators/mergeInternals.ts:136:10)
    at /Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/operators/mergeMap.ts:95:42
    at SafeSubscriber.<anonymous> (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/util/lift.ts:24:18)
    at /Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/Observable.ts:226:22
    at Object.errorContext (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/util/errorContext.ts:29:5)
    at Observable.Object.<anonymous>.Observable.subscribe (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/Observable.ts:220:5)
    at /Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/lastValueFrom.ts:59:12
    at new Promise (<anonymous>)
    at lastValueFrom (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/rxjs/src/internal/lastValueFrom.ts:56:10)
    at RouterResponseController.transformToResult (/Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/@nestjs/core/router/router-response-controller.js:33:45)
    at /Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/@nestjs/core/router/router-execution-context.js:173:52
    at /Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/@nestjs/core/router/router-execution-context.js:47:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at /Users/aleksey.topchy/IdeaProjects/philit/medical/aip-back/node_modules/@nestjs/core/router/router-proxy.js:9:17
 FAIL  test/app.e2e-spec.ts (9.271 s)
  AuthController (e2e)
    ✓ /auth/register (POST) (196 ms)
    ✓ /auth/login (POST) (100 ms)
    ✕ /auth/me (GET) (48 ms)

  ● AuthController (e2e) › /auth/me (GET)

@moinulse
Copy link

@topchyalexey Have you been able to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants