Skip to content

SQC-652 Implement Hyperdrive TLS proxy in Miniflare#11219

Merged
dario-piotrowicz merged 1 commit intocloudflare:mainfrom
Ltadrian:agracia/SQC-652-implement-hyperdrive-tls-proxy
Nov 20, 2025
Merged

SQC-652 Implement Hyperdrive TLS proxy in Miniflare#11219
dario-piotrowicz merged 1 commit intocloudflare:mainfrom
Ltadrian:agracia/SQC-652-implement-hyperdrive-tls-proxy

Conversation

@Ltadrian
Copy link
Contributor

@Ltadrian Ltadrian commented Nov 7, 2025

Fixes SQC-652.

This fixes the problem of when a user runs
npx wrangler dev
with a Hyperdrive binding and localConnectionString pointing to a database that requires TLS. In such cases, the command will result in the following TLS error:

{ "error": "connection is insecure (try using `sslmode=require`)" }

This change adds a proxy layer to Miniflare and introduces a proxy service for Hyperdrive bindings. The proxy layer attempts to establish a TLS connection with the appropriate database based on the specified sslmode parameter.

This allows users to simply set sslmode=require in their localConnectionString, enabling their Hyperdrive binding to automatically upgrade to TLS instead of requiring them to manually configure TLS settings in their database driver. (Note: this still will not work without additional changes to the binding service.)


@changeset-bot
Copy link

changeset-bot bot commented Nov 7, 2025

🦋 Changeset detected

Latest commit: d8209a2

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 7, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@11219

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@11219

miniflare

npm i https://pkg.pr.new/miniflare@11219

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@11219

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@11219

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@11219

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11219

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@11219

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@11219

wrangler

npm i https://pkg.pr.new/wrangler@11219

commit: d8209a2

@Ltadrian Ltadrian force-pushed the agracia/SQC-652-implement-hyperdrive-tls-proxy branch 2 times, most recently from 0d78b14 to d3980b4 Compare November 12, 2025 16:28
@Ltadrian Ltadrian changed the title SQC-652 initial implementation of miniflare hyperdrive tls proxy SQC-652 Implement Hyperdrive TLS proxy in Miniflare Nov 12, 2025
@Ltadrian Ltadrian force-pushed the agracia/SQC-652-implement-hyperdrive-tls-proxy branch 2 times, most recently from 7814814 to 3c93c1a Compare November 12, 2025 21:07
@Ltadrian Ltadrian marked this pull request as ready for review November 12, 2025 21:10
@Ltadrian Ltadrian requested a review from a team as a code owner November 12, 2025 21:10
@Ltadrian Ltadrian force-pushed the agracia/SQC-652-implement-hyperdrive-tls-proxy branch 4 times, most recently from d2b0005 to 8868c95 Compare November 12, 2025 22:26
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions and suggestions.
But it looks like this is a legitimate failure in CI?
https://github.com/cloudflare/workers-sdk/actions/runs/19313849941/job/55240551979?pr=11219#step:6:3822

@petebacondarwin petebacondarwin marked this pull request as draft November 13, 2025 17:03
@Ltadrian Ltadrian force-pushed the agracia/SQC-652-implement-hyperdrive-tls-proxy branch from 8868c95 to fd426a0 Compare November 13, 2025 19:09
@Ltadrian
Copy link
Contributor Author

A few questions and suggestions. But it looks like this is a legitimate failure in CI? https://github.com/cloudflare/workers-sdk/actions/runs/19313849941/job/55240551979?pr=11219#step:6:3822

Yes this actually was a failure, I had missed this test but should be fixed now

@Ltadrian Ltadrian force-pushed the agracia/SQC-652-implement-hyperdrive-tls-proxy branch 8 times, most recently from fdc7f10 to 48ef6d2 Compare November 17, 2025 00:08
@Ltadrian
Copy link
Contributor Author

@petebacondarwin think I could get a re-review on this? I fixed some more tests and cleaned up some issues when testing more edge cases. I think currently the tests failing are flaky tests?

@ReppCodes
Copy link
Contributor

Few minor comments, but LGTM!

@Ltadrian Ltadrian force-pushed the agracia/SQC-652-implement-hyperdrive-tls-proxy branch from 9880761 to 90a48f6 Compare November 18, 2025 18:55
Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I have added mostly minor comments / suggestions.

If one thing, I feel like there is quite some code duplication across the PR.

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Nov 19, 2025
@Ltadrian Ltadrian force-pushed the agracia/SQC-652-implement-hyperdrive-tls-proxy branch 4 times, most recently from 7f890bc to b4c59ce Compare November 19, 2025 21:06
@Ltadrian Ltadrian force-pushed the agracia/SQC-652-implement-hyperdrive-tls-proxy branch from b4c59ce to 7a976dd Compare November 20, 2025 14:13
Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a pretty superficial review of this since this is already approved by two people and also because I don't have much context of this.

Generally looks good to me 😄

Comment on lines +6 to +7
Implement Hyperdrive binding TLS miniflare proxy. This will allow for wrangler dev hyperdrive bindings to connect to external
databases that require TLS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
Implement Hyperdrive binding TLS miniflare proxy. This will allow for wrangler dev hyperdrive bindings to connect to external
databases that require TLS.
Implement Hyperdrive binding TLS miniflare proxy. This will allow for wrangler dev hyperdrive bindings to connect to external databases that require TLS.

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Let's give this a go.

allow for wrangler dev hyperdrive bindings to connect to external
databases that require TLS.
- Supports upgrading TLS connection to database by setting
  sslmode=prefer or sslmode=require or sslmode=disable in
  localConnectionString
- Default sslmode is disable
- Adds integration tests to miniflare test suite
@petebacondarwin petebacondarwin force-pushed the agracia/SQC-652-implement-hyperdrive-tls-proxy branch from 7a976dd to d8209a2 Compare November 20, 2025 17:40
@dario-piotrowicz dario-piotrowicz merged commit 524a6e5 into cloudflare:main Nov 20, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants