Please check if your PR fulfills the following requirements:
[x] Tests for the changes have been added (for bug fixes / features)
[ ] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
[ x ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:
What is the current behavior?
Currently when my app has enableShutdownHooks it will fail every time because of:
.../node_modules/@nestjs/core/injector/instance-links-host.js:24
throw new unknown_element_exception_1.UnknownElementException(this.getInstanceNameByToken(token));
^
Error: Nest could not find Symbol() element (this provider does not exist in the current context)
at InstanceLinksHost.get (.../node_modules/@nestjs/core/injector/instance-links-host.js:24:19)
at Object.find (.../node_modules/@nestjs/core/injector/abstract-instance-resolver.js:8:60)
at Object.get (.../node_modules/@nestjs/core/injector/module.js:399:29)
at RedisModule2.onApplicationShutdown (.../node_modules/@liaoliaots/nestjs-redis/dist/redis/redis.module.js:68:48)
at callAppShutdownHook (.../node_modules/@nestjs/core/hooks/on-app-shutdown.hook.js:51:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at NestApplication.callShutdownHook (.../node_modules/@nestjs/core/nest-application-context.js:254:13)
at process.cleanup (.../node_modules/@nestjs/core/nest-application-context.js:191:17)
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently when my app has
enableShutdownHooks
it will fail every time because of:Digging through the NestJS source code and logging all the issues, this: https://github.com/nestjs/nest/blob/master/packages/core/injector/module.ts#L611-L615 the
self.id
NEVER matches up with the ID of whateverthis.moduleRef.get<RedisModuleOptions>(REDIS_MERGED_OPTIONS)
orthis.moduleRef.get<RedisClients>(REDIS_CLIENTS)
is.This check always fails: https://github.com/nestjs/nest/blob/master/packages/core/injector/instance-links-host.ts#L44-L46
This PR also address and fixes this issue: https://github.com/liaoliaots/nestjs-redis/issues/335
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information