cookies icon indicating copy to clipboard operation
cookies copied to clipboard

Upgrading to 1.1.x causes a crash at runtime

Open tristan957 opened this issue 5 years ago • 6 comments

Error: Cannot find module '@nestjs/graphql'
Require stack:
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/interceptors/clear-cookies.interceptor.js
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/decorators/clear-cookies.decorator.js
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/decorators/index.js
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/index.js
- /home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/index.js
- /home/tristan957/Projects/myma-store/server/src/authentication/authentication.controller.ts
- /home/tristan957/Projects/myma-store/server/src/authentication/authentication.module.ts
- /home/tristan957/Projects/myma-store/server/src/app.module.ts
- /home/tristan957/Projects/myma-store/server/src/index.ts
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/home/tristan957/Projects/myma-store/server/node_modules/@nestjsplus/cookies/dist/interceptors/clear-cookies.interceptor.js:11:19)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)

Looks like the dependency on the graphql package somehow bubbled up even when I am not using graphql in my project. I checked the package.json but I didn't see why this would happen.

tristan957 avatar Mar 29 '20 17:03 tristan957

Got the same error, I'm not using @nestjs/graphql

rogyvoje avatar Mar 30 '20 13:03 rogyvoje

Sorry guys. Unintended side effect. Have to think about how to solve this so the package works in both GraphQl and non-GraphQL contexts.

Short term work around would be to go back to 1.1.0 (only diff is that version doesn't support GraphQL), or install @nestjs/graphql. 😢 Sorry for not having a better answer right now.

@igor-radivojevic-ct @tristan957

johnbiundo avatar Mar 30 '20 15:03 johnbiundo

@johnbiundo I believe a way around this would be to dynamically load the graphql package using a similar technique which is discussed at https://github.com/nestjs/terminus/pull/593#discussion_r399824081. If you follow the line of code linked, maybe that could provide you with an idea. Thanks for your work.

tristan957 avatar Mar 30 '20 16:03 tristan957

@tristan957 thanks for the pointer. I need to come back and spend some time on this, which will have to wait a bit due to some other current work. Thanks for your support.

johnbiundo avatar Mar 30 '20 19:03 johnbiundo

No problem.

tristan957 avatar Mar 30 '20 20:03 tristan957

Should we rollback latest to 1.1.0? Does 1.1.1 version includes any critical bug fix?

eladshamai avatar Mar 09 '21 20:03 eladshamai