Doesn't work with NODE_ENV = production
arslan-akh opened this issue · comments
Description
I am using nestjs bull if NODE_ENV=development everything works fine but when I change my NODE_ENV to production I get an error while trying to call myQueue.add() method to add job to the queue. If I try to set the test data to Redis with ioredis all is working fine
Error: Connection is closed.
at EventEmitter.sendCommand (/usr/src/app/node_modules/.pnpm/ioredis@5.3.2/node_modules/ioredis/built/Redis.js:332:28)
at Script.execute (/usr/src/app/node_modules/.pnpm/ioredis@5.3.2/node_modules/ioredis/built/Script.js:59:26)
at EventEmitter.addJob (/usr/src/app/node_modules/.pnpm/ioredis@5.3.2/node_modules/ioredis/built/utils/Commander.js:111:27)
at Object.addJob (/usr/src/app/node_modules/.pnpm/bull@4.11.3/node_modules/bull/lib/scripts.js:49:19)
at addJob (/usr/src/app/node_modules/.pnpm/bull@4.11.3/node_modules/bull/lib/job.js:82:18)
at /usr/src/app/node_modules/.pnpm/bull@4.11.3/node_modules/bull/lib/job.js:95:14
Bull version
bull 4.11.3, @nestjs/bull 10.0.1
NODE_ENV is not used in Bull repo, i.e. the code is the same. Furthermore many people, me included, use Bull with NODE_ENV=production without any issues. It is most likely some code in your codebase that is not the same in production mode and is leading to this error. I would check on the connection ENV variables...