By fsduncan
I’m trying to set up an example app with a Node.js Express server, a managed DO Redis db, and a Node.js worker.
I’m using the server.js and worker.js code from Heroku’s “node-workers-example”. I’m deploying by pushing containers to a DO Container Registry.
I got this app working locally with docker-compose, using the docker hub’s official redis image as the db, but I can’t get it to connect to my managed DO redis db.
(The code linked above doesn’t catch errors, but if I catch them, I see this):
Error: read ECONNRESET
MaxRetriesPerRequestError: Reached the max retries per request limit (which is 20). Refer to "maxRetriesPerRequest" option for details.
The app itself appears to just hang and timeout when I post to the /job endpoint and try to make the first connection do the DB.
Things I’ve checked:
DATABASE_URL, which I renamed to REDIS_URL to work with this code.bull, which uses ioredis under the hood to connect. I thought it might be a problem with TLS, but I was able to connect locally using ioredis with the same connection string (DATABASE_URL, which is rediss://default:<password, etc.>I don’t know if the problem is specific to Node Bull here, but I don’t know how to begin debugging it beyond just logging as much as I can to the JS console.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
I had exactly the same issue with the same code sample from heroku.
The solution is to pass tls: {} to the redis config of each Queue instances:
code
const workQueue = new Queue(
'NAME',
'rediss://...',
{
redis: {
tls: {},
},
},
);
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.