Unable to deploy from GHA

It is failing on the connection to Upstash Redis.

I am able to do a fly deploy locally. I am not able to get it to work from GitHub Actions CI, either running it on GitHub with fly deploy, or using fly deploy --remote-only to run it on a Fly.io App Builder Machine.

  1. I want to assume the cause of the issue is that the redis:// protocol connections are only available within the Fly network, but since build & deploy work locally, that doesn’t make sense. Additionally, if that is the case, then why doesn’t --remote-only, which builds inside the Fly.io network on an App Builder Machine, work?

  2. The error changes in interesting ways depending on where I run the build.

On Fly.io App Builder Machine:

node:internal/event_target:1099
  process.nextTick(() => { throw err; });
                           ^
Error: connect ENETUNREACH fdaa:9:391c:0:1::4:6379 - Local (:::0)
    at internalConnect (node:net:1093:16)
    at defaultTriggerAsyncIdScope (node:internal/async_hooks:464:18)
    at GetAddrInfoReqWrap.emitLookup [as callback] (node:net:1492:9)
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:132:8)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:326:10)
    at [kOnMessage] (node:internal/worker:337:37)
    at MessagePort.<anonymous> (node:internal/worker:232:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:825:20)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28) {
  errno: -101,
  code: 'ENETUNREACH',
  syscall: 'connect',
  address: 'fdaa:9:391c:0:1::4',
  port: 6379
}
Node.js v20.13.1
 ELIFECYCLE  Command failed with exit code 1.

On Github Actions:

#14 28.60 node:internal/event_target:1099
#14 28.60   process.nextTick(() => { throw err; });
#14 28.60                            ^
#14 28.61 Error: getaddrinfo ENOTFOUND fly-rough-silence-8307.upstash.io
#14 28.61     at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26)
#14 28.61 Emitted 'error' event on Worker instance at:
#14 28.61     at [kOnErrorMessage] (node:internal/worker:326:10)
#14 28.61     at [kOnMessage] (node:internal/worker:337:37)
#14 28.61     at MessagePort.<anonymous> (node:internal/worker:232:57)
#14 28.61     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:825:20)
#14 28.61     at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28) {
#14 28.61   errno: -3007,
#14 28.61   code: 'ENOTFOUND',
#14 28.61   syscall: 'getaddrinfo',
#14 28.61   hostname: 'fly-rough-silence-8307.upstash.io'
#14 28.61 }
#14 28.61 
#14 28.61 Node.js v20.13.1
#14 28.69  ELIFECYCLE  Command failed with exit code 1.

The settings in both cases are identical, so it is interesting to me that Fly.io App Builder is getting a core error of:

{
  errno: -101,
  code: 'ENETUNREACH',
  syscall: 'connect',
  address: 'fdaa:9:391c:0:1::4',
  port: 6379
}

while GHA is getting:

{
  errno: -3007,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'fly-rough-silence-8307.upstash.io'
}

NOTE: I am building a compiled Javascript app, in SvelteKit, so my ENV variables may be utilized during the build in ways they are not normally for other apps like React. I need my build env to have access to my resources, the same way my deployed app will.

Back to the original issue… it is interesting that the Fly.io machine was able to translate the hostname to the correct IPv6 address, so at least that is one step further than GHA alone was able to get.

Perhaps my issue is that I need to enable TLS?

Got it working with --remote-only - part of the fix was the port number is wrong in some of the documentation: https://community.fly.io/t/am-unable-to-connect-to-upstash-redis/20044