Question: how is this the case with Websockets? Is there still a handshake procedure that requires e
Question: how is this the case with Websockets? Is there still a handshake procedure that requires extra round-trips?
Connection terminated unexpectedly error thrown while trying to query my Postgres DB w/ Hyperdrive. Using almost exactly the example code here:client.connect() is finishing fine, but client.query() is throwing Connection terminated unexpectedly . I'm setting node_compat = true in my wrangler.toml as well. Any ideas?rds-ca-rsa2048-g1, the issue fixed itself when changing back to the default rds-ca-2019 . Definitely a confusing error message (not sure if this is a pg issue, or a Workers issue via the connect call), but hopefully this can help someone else!connect() directly?pg (not sure what Hyperdrive->AWS is using) doesn't verify certificates
connect() directly w/ sslmode=REQUIRE doesn't verify the certs, so it works as expectedrequire (and prefer, but we ultimately require TLS).and the “newer” AWS CA requires the client (Hyperdrive) to have it in its trust store.I'm a little unsure what you meant by this bit then
require wouldn't cert validation not take place?rds-ca-rsa2048-g1 CA, correct?connect() API without Hyperdrive you have no issues, correct?node_compat which is a set of polyfills (https://github.com/ionic-team/rollup-plugin-node-polyfills/) so I'm not sure if you'd be able to get that working alongside next-on-pagesnode_compat to Pages, maybe you can ask the next-on-pages team to add it to that framework.node-postgres node_compat is a result of the individual drivers, not Hyperdrive, correct?connect() itself requires itnode-postgres doesn't have those, so possibly, but I have no ideanode_compat vs nodejs_compat dilemma in this channel so farconst client = new Client({
connectionString: context.env.DB_HYPERDRIVE.connectionString,
});
// Connect to our database
console.log("START CONNECT");
await client.connect();
console.log("END CONNECT");
// Test query
console.log("START QUERY");
const result = await client.query({
text: "SELECT * FROM pg_tables",
});
console.log("END QUERY");
// Returns result rows as JSON
return context.json({ result: result });