I have been developing an App on Fly.io that for some reason started having issues yesterday. The application is deploying just fine but I then found that the applications login pages had stopped working.
After some deep debugging I have found that this seems to be related to DNS resolution of my Next.js Application whilst rendering server side.
I am utilising next-auth for authentication and the sign up page (and others) use fetch to make API calls when server side using the canonical URL of the application (IE [appname]
.fly.dev). This does not seem to be resolving and is causing a TypeError: fetch failed
error which is indicative of a bad URL.
This was working fine previously so I’m wondering if something has changed / is there a current issue?
Just to confirm that this was an issue I have also SSH’d into the running instance, installed curl and tried to curl the apps external address and got a similar error.
What would be the correct address to call when wanting to talk to the local machine? as http://localhost:8080
also seems to fail when using fetch (Although it does work through curl
oddly). Reason I ask is that next-auth did implement a NEXTAUTH_URL_INTERNAL env var that can be used for situations like this.