I’m trying to use ioredis
in the Vercel function, in an /api/
file.
But I’m getting this error: [ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379.
Can I have a Redis connection in the Vercel functions?
I’m trying to use ioredis
in the Vercel function, in an /api/
file.
But I’m getting this error: [ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379.
Can I have a Redis connection in the Vercel functions?
Hey, Alex! Welcome to the Vercel Community
Yes, you can use ioredis
in Vercel functions! The error you’re seeing suggests you’re trying to connect to a local Redis instance (127.0.0.1:6379), which won’t work in Vercel’s serverless environment.
You’ll need to use a hosted Redis service such as:
@pawlean Thanks for the quick answer!
And if I have a Redis db on Render or Upstash? While developing locally I use a connection url to communicate with the database. How do I do this on Vercel?
UPDATE: It works. It was my fault not updating the ENV variable. Thank you.
I’m glad you got there in the end! Thanks Alex
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.