planetscale/database-js

Getting ENOTFOUND from Docker image on fly.io

CanRau opened this issue · 3 comments

CanRau commented

Hey I'm trying to deploy a NextJS (13 using app-dir) app to fly.io but hitting the following error, also tried passing the global fetch from NextJS to the connection config

db:execute:pscale:ERROR TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11522:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: Error: getaddrinfo ENOTFOUND "aws.connect.psdb.cloud"
      at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:119:26)
      at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    errno: -3008,
    code: 'ENOTFOUND',
    syscall: 'getaddrinfo',
    hostname: '"aws.connect.psdb.cloud"'
  }
}

Not even sure this is the right place here but felt like a good starting point.
Never had this issue before, locally and Cloudflare Pages/Worker work as expected.

Any idea or hint would be ver much appreciated 🙏🏼

Is there any information on how you're configuring this? This is suggesting it can't resolve DNS for that hostname.

Without much experience with Next or what is going on here, based on the stacktrace alone, it sorta seems to suggest you have some double quoting? The hostname appears to be "aws.connect.psdb.cloud" and not aws.connect.psdb.cloud, but I can't tell if that's just the formatting or if that's your literal value. It's stands out since it's double quoted within the hostname: '"aws.connect.psdb.cloud"' bit.

@CanRau Interesting!

At first glance, I'm wondering if you're injecting your environment in a way that's causing the quotes to be part of what's being passed to the driver. If I look at:

Error: getaddrinfo ENOTFOUND "aws.connect.psdb.cloud"

And

hostname: '"aws.connect.psdb.cloud"'

It looks like you may be looking up "aws.connect.psdb.cloud" with the quotes instead of just aws.connect.psdb.cloud

If that doesn't work, let me know!

CanRau commented

Yap, you're totally right, thanks @mattrobenolt & @nickvanw ❤️
I totally forgot about that quirk with fly's secret import command, it literally only properly accepts NAME=VALUE pairs 😅