[GH-ISSUE #1044] hyperdrive not working #229

Open
opened 2026-05-06 12:38:22 +02:00 by BreizhHardware · 1 comment

Originally created by @xucongyong on GitHub (May 4, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/1044

https://hyperdrive-test-dbt.pages.dev/api/test-hyperdrive

error: {"success":false,"error":"Uncaught TypeError: Failed to establish the WebSocket connection: expected server to reply with HTTP status code 101 (switching protocols), but received 530 instead."}

I can connect to the database normally, but I can't connect via Hyperdrive. How should I fix this?

code:

import { Client } from "pg";

export default {
async fetch(request, env, ctx) {
// Hyperdrive provides a unique generated connection string to connect to
// your database via Hyperdrive that can be used with your existing tools
const client = new Client({ connectionString: env.HYPERDRIVE.connectionString });
await client.connect();

try {
  // Sample SQL query
  const result = await client.query("SELECT * FROM pg_tables");

  return Response.json({result: result.rows});
} catch (e) {
  return Response.json({ error: e instanceof Error ? e.message : e }, { status: 500 });
}

},
}

Originally created by @xucongyong on GitHub (May 4, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/1044 https://hyperdrive-test-dbt.pages.dev/api/test-hyperdrive error: {"success":false,"error":"Uncaught TypeError: Failed to establish the WebSocket connection: expected server to reply with HTTP status code 101 (switching protocols), but received 530 instead."} I can connect to the database normally, but I can't connect via Hyperdrive. How should I fix this? code: import { Client } from "pg"; export default { async fetch(request, env, ctx) { // Hyperdrive provides a unique generated connection string to connect to // your database via Hyperdrive that can be used with your existing tools const client = new Client({ connectionString: env.HYPERDRIVE.connectionString }); await client.connect(); try { // Sample SQL query const result = await client.query("SELECT * FROM pg_tables"); return Response.json({result: result.rows}); } catch (e) { return Response.json({ error: e instanceof Error ? e.message : e }, { status: 500 }); } }, }
Author
Owner

@james-elicx commented on GitHub (May 5, 2026):

Please can you share a repository that reproduces the issue?

I deployed a project last week that uses Planetscale Postgres via Hyperdrive and have not run into this problem.

<!-- gh-comment-id:4382161526 --> @james-elicx commented on GitHub (May 5, 2026): Please can you share a repository that reproduces the issue? I deployed a project last week that uses Planetscale Postgres via Hyperdrive and have not run into this problem.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#229
No description provided.