title: Google Cloud Function cannot connect to Redis
body: <p>We have a Google Cloud Function that tries to connect to a Redis server that sits on a Compute Engine instance. The Compute Engine Redis port is open and can connect to the Redis server from our local machines. Nonetheless, when the Cloud Function tries to do so, it gets the following error: </p>
  
  <blockquote>
    <p>Redis connection to 35.xxx.xx.xx:6379 failed - connect ETIMEDOUT 35.xxx.xx.xx:6379 at Object.exports._errnoException (util.js:1020:11) at exports._exceptionWithHostPort (util.js:1043:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1105:14) code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect', address: '35.xxx.xx.xx', port: 6379 }</p>
  </blockquote>
  
  <p>We are using the <strong><em><a href="https://github.com/NodeRedis/node_redis" rel="nofollow noreferrer">redis</a></em></strong> npm package (Redis Node Client) to connect which again works from our local machines. </p>
  
  <p>We pass the IP of the EC server to the <em>host</em> value and the authentication secret to the <em>password</em> value. Again this seems to work locally. </p>
  
  <p>Any ideas?</p>