-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix auth urls #769
Fix auth urls #769
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, nice catch. Without the trailing slash, the new "path" replaces the last path segment, yeah?
Yes, MiroslavPetrik caught it: #750 (comment). I think I broke it in the refactor to use |
I'll add some tests for this once I figure out how to mock smtp. |
@@ -31,7 +31,7 @@ export class Auth { | |||
const [host, port] = connectConfig.address; | |||
const baseUrl = `${ | |||
connectConfig.tlsSecurity === "insecure" ? "http" : "https" | |||
}://${host}:${port}/db/${connectConfig.database}/ext/auth`; | |||
}://${host}:${port}/db/${connectConfig.database}/ext/auth/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here I found one more problem, Next does not want to connect to host of localhost
, so I have
const hostFix = host === "localhost" ? "127.0.0.1" : host;
}://${host}:${port}/db/${connectConfig.database}/ext/auth/`; | |
}://${hostFix }:${port}/db/${connectConfig.database}/ext/auth/`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
original error,
found the solution in
https://stackoverflow.com/questions/74165121/next-js-fetch-request-gives-error-typeerror-fetch-failed
Not sure if its not only local, my node version is
$ node -v
v18.18.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's related to this issue: nodejs/node#44731
I believe this is fixed in Node v20 (see nodejs/node#44731), but maybe there is something we can do to opt-into the same behavior in our codebase here. I'll look into that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested with node v20.9.0, and it still fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your operating system? If Node v20 is still failing in the same way, it seems like the DNS resolver is not returning 127.0.0.1
for localhost
lookup which is definitely odd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on Windows 11. Solved it with (for now)
import dns from "node:dns";
dns.setDefaultResultOrder("ipv4first");
it also impacted the default edgedb client connection. You are right with the DNS resolver, it prioritizes the ipv6, as in the screenshot of the error we see ::1
.
I don't know where to change the priority in the OS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MiroslavPetrik perhaps this comment might help: nodejs/node#40537 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will save that as alternative option for developing on windows 11.
Still it seems temporary, just noticed that even the hosts file no longer uses localhost mapping (they are commented out) as that somehow interferes with ipv6 adoption, so maybe the edgedb could listen on ipv6 as well?
I don't know much about networking. Just expanding on what I just read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's possible to make edgedb listen on ipv6 as well. There was a similar issue previously with Deno resolving localhost to the ipv6 ::1
address: #376 (comment)
No description provided.