miniflare
miniflare copied to clipboard
Connecting to CF Tunnel fails
I have a tunnel to a postgres server to which I connect using the cloudflare/worker-template-postgres
which works just fine on wrangler.
When trying to connect to the tunnel, this message pops up
You must call accept() on this WebSocket before sending messages
at WebSocket.[kClose] (node_modules/@miniflare/web-sockets/src/websocket.ts:168:13)
I think it might be related to https://github.com/cloudflare/miniflare/issues/284
The code I use to connect is
this.client = new Client({
user: "myUser",
database: "myDB",
// hostname is the full URL to your pre-created Cloudflare Tunnel, see documentation here:
// https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/create-tunnel
hostname: "https://pg.mytunnel.com",
password: DATABASE_PASSWORD, // use a secret to store passwords
port: "5432",
tls: {
enabled: false,
},
});
await this.client.connect();
Hey! 👋 Miniflare 2.9.0
has just been released, which may have fixed this issue. Would be able to try upgrading and let me know if it's fixed?