-
Notifications
You must be signed in to change notification settings - Fork 7
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
localtest.me
connection issue on ARM Mac
#3
Comments
Hi Stefan, if you are using the The reason Caddy is used as a reverse proxy is that the To avoid having to accept the self-signed cert on your local machine for development, Caddy trusts it and proxies the connection over a plain HTTP connection while preserving the host header for neon. It seems like the local proxy stopps working after some time in your case. Do you get any errors in your container logs? |
Thanks for the logs. I see the same error block in my logs about invalid
Unfortunately I don't have access to an ARM-based machine to test if this is the reason it's not working but it is strage that it worked partially before. Could you maybe try to clean up the |
Funny, that you say that. I was not aware that the DB was also used by the proxy itself. I found a small bug that can lead to state where the schema was not created. Unfortunately, it still throws the same error. |
Update: I think it all boils down to the fact that my machine cannot resolve But anyway, when I change the import { neon, neonConfig } from '@neondatabase/serverless';
const connectionString = 'postgres://postgres:postgres@db.localtest.me:5432/main';
neonConfig.fetchEndpoint = (host) => {
const protocol = host === 'db.localtest.me' ? 'http' : 'https';
const port = host === 'db.localtest.me' ? 4444 : 443;
const usedHost = host === 'db.localtest.me' ? 'localhost' : host;
return `${protocol}://${usedHost}:${port}/sql`; // resolves to 'http://localhost:4444/sql' instead of 'http://db.localtest.me:4444/sql'
};
const sql = neon(connectionString);
const [result] = await sql`SELECT * FROM NOW()`;
console.log(result); When I got the setup working the first time, I'm pretty sure that I hardcoded this in a similar way while I was debugging. This is good enough for me, because it eventually works. Feel free to close this issue, except you want to investigate any further. And again, thanks for this repo and for answering my questions so quickly! |
The The neon proxy does some SNI stuff and doesn't accept The caddy reverse-proxy already sets the upstream host header but unfortunately it seems to be required to use the cert domain in the connection string, otherwise the proxy returns This is kind of brittle but unfortunately I haven't found a workaround so far. I wonder what causes the DNS to fail on your setup for that domain... By the way, I tried publishing a multi-platform image for AMD64 + ARM64. It's not going to solve this issue and I mainly did it to understand how that is done with GitHub Actions 😅 It would be very helpful if you could give that a try sometime from |
localtest.me
connection issue on ARM Mac
Thanks for clarifying. I just implied that Caddy owns that domain because it was linked on their website. I finally got it sorted. The issue indeed was that For anyone else having a similar issue, you want to make sure that
|
Just wanted to mention that if one is using Chrome, all domains ending with |
Hi Timo. Thank you so much for making this proxy publicly available. I used your example and it works great. I still have one general question that I could not figure out myself.
I'm not very familiar with Caddy, but in my understanding, I somehow have to configure it on my local machine to make this all work?
So I installed Caddy via brew, played around a bit, set up the neon proxy as described in your Readme and everything worked eventually. However, after a couple of hours, the
npm run test
fails with an error that tells me the host is not available anymore.Can you give me some basic instruction on what I have to do with my local caddy setup (like e.g. does the deamon have to run?). I also wonder why caddy is used in the first place, when the configured neon fetch endpoint is not even using https.
Sorry for asking dumb questions, I appreciate any help :)
The text was updated successfully, but these errors were encountered: