Progress emitter throws error if jobId has comma in it
Created by: abdatta
I'm getting an error when I set a jobId that has a comma in it.
SyntaxError: Unexpected token h in JSON at position 2
at JSON.parse (<anonymous>)
at Redis.messageHandler (/usr/lib/node_modules/@abdatta/bulls-eye/node_modules/bull/lib/queue.js:404:50)
at Redis.emit (events.js:315:20)
at DataHandler.handleSubscriberReply (/usr/lib/node_modules/@abdatta/bulls-eye/node_modules/ioredis/built/DataHandler.js:80:32)
at DataHandler.returnReply (/usr/lib/node_modules/@abdatta/bulls-eye/node_modules/ioredis/built/DataHandler.js:47:18)
at JavascriptRedisParser.returnReply (/usr/lib/node_modules/@abdatta/bulls-eye/node_modules/ioredis/built/DataHandler.js:21:22)
at JavascriptRedisParser.execute (/usr/lib/node_modules/@abdatta/bulls-eye/node_modules/redis-parser/lib/parser.js:544:14)
at Socket.<anonymous> (/usr/lib/node_modules/@abdatta/bulls-eye/node_modules/ioredis/built/DataHandler.js:25:20)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
On following the error message, I end up on this line https://github.com/OptimalBits/bull/blob/4177e57f5a167e89cd6de08ac19cc755757fc158/lib/queue.js#L404
I see the code tried to extract the jobId using the location of the first comma, but since the jobId itself has a comma in it, it fails the extract the full jobId, and the remaining text is not parseable by JSON.parse.
I need to fix this urgently since a code in production is breaking. I would be grateful if somebody can guide be on how to best fix this.