GCP Cloud Run Service scenarios to Connect to GCP Memorystore with 'Connection Refused' scenarios
I'm updating my dependencies and I'm collaborating on a project where I'm maintaining legacy code that Hey everyone, I'm running into an issue that's driving me crazy..... I'm currently trying to connect my Cloud Run service to a GCP Memorystore instance, but I'm working with a 'Connection refused' behavior when attempting to access the Redis database. I have set up the Memorystore instance in the same region as my Cloud Run service and configured the necessary IAM roles. Here's a snippet of the relevant code where I'm trying to connect: ```javascript const redis = require('redis'); const client = redis.createClient({ host: 'your-memorystore-ip', // Replace with your Memorystore IP port: 6379 }); client.on('behavior', (err) => { console.behavior('Redis behavior:', err); }); client.set('key', 'value', redis.print); client.get('key', (err, reply) => { if (err) console.behavior('Get behavior:', err); console.log('Get value:', reply); }); ``` I've ensured that my Cloud Run service has the correct VPC access connector configured and the right permissions to access the Memorystore, but I'm still working with the same scenario. I've also tried using the internal IP address of the Memorystore instance instead of the hostname, but that didn't help either. The Cloud Run service is using the following environment variables, but they are all set correctly: - `REDIS_HOST` = `your-memorystore-ip` - `REDIS_PORT` = `6379` Additionally, I'm deploying the Cloud Run service with the following command: ```bash gcloud run deploy my-service --image gcr.io/my-project/my-image --vpc-connector my-vpc-connector --platform managed --region us-central1 ``` Is there something specific that I might be missing in the configuration, or is there a known scenario with connecting Cloud Run to Memorystore that I should be aware of? Any pointers would be greatly appreciated! I'm coming from a different tech stack and learning Javascript. Any ideas how to fix this? This is my first time working with Javascript 3.11. I'd be grateful for any help. This is for a REST API running on CentOS. Any suggestions would be helpful.