Redis is a separate service, so having Node.js hosting doesn't automatically mean Redis is available on the server.
The issue may be related to Redis availability, network access, or connection configuration.
Check the following:
- Confirm whether your hosting provider supports Redis.
- Verify the Redis hostname and port provided by the hosting provider.
- Check whether Redis requires authentication.
- Make sure the application is using the correct connection URL.
- Confirm whether the Redis service is running and accessible from your hosting account.
- Check whether your hosting environment allows connections to the Redis service.
For example, using the redis Node.js package:
const { createClient } = require('redis');
const client = createClient({
url: process.env.REDIS_URL
});
client.on('error', (err) => {
console.error('Redis connection error:', err.message);
});
If Redis isn't supported by your hosting environment, ask your provider about available alternatives before changing your application architecture.