fix(miniflare): Skip creating hyperdrive proxy server for local database#13390
Conversation
🦋 Changeset detectedLatest commit: b29b302 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 |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
ffa97e3 to
c73dad3
Compare
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
d3a206c to
f10a220
Compare
f10a220 to
f7a5c21
Compare
petebacondarwin
left a comment
There was a problem hiding this comment.
Tidy PR. Thanks!
Please can you update the changeset and address the devin comment about re-assigning the log object during setOptions.
e321cef to
2b26e2d
Compare
@petebacondarwin thank you! I have updated these, and the tests failing seem unrelated to my current PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
59c3dfd to
395563f
Compare
395563f to
fe25fa5
Compare
fe25fa5 to
7d7392a
Compare
549446b to
d116ea5
Compare
fix proxy error handling Skip creating a local TCP proxy server for Hyperdrive bindings when SSL is not needed (sslmode disabled or not specified), connecting directly to the database instead. This avoids connection refused errors caused by firewall rules or proxy port binding issues on Windows/macOS. Also fixes two bugs in HyperdriveProxyController: - Add missing error handler on the proxy net.Server to prevent silent crashes - Fix missing return in dispose() that caused servers not to be awaited on cleanup
d116ea5 to
1ef0256
Compare
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
|
Investigating the CI failures... |
When wrangler dev is force-killed via tree-kill at e2e teardown, workerd's outbound TCP connection to the test mock database server is reset rather than gracefully closed. With the Hyperdrive proxy now skipped for sslmode=disable (the default), that RST surfaces directly on the per-connection socket of the test's nodeNet.Server. Without an error listener Node escalates it to uncaughtException, which Vitest catches as an unhandled error and fails the run even though the test itself passed. Add a small ECONNRESET-only-tolerant error handler to the affected mock sockets in dev.test.ts and get-platform-proxy.test.ts. This is the same pattern already used at dev.test.ts:947, just generalised and applied where it was missing.
|
Hi @Ltadrian — pushed a follow-up commit (b29b302) to address the failing Wrangler E2E jobs ( What was failingIn every failing job the affected test itself passed (all assertions green), but Vitest then caught two unhandled
Why this PR triggered itBefore this PR: After this PR (when The proxy was effectively absorbing the abrupt-close edge case for these tests. The fixAttach an ECONNRESET-tolerant function ignoreEconnreset(err: NodeJS.ErrnoException): void {
if (err.code !== 'ECONNRESET') {
throw err;
}
}No production code changes — the miniflare behaviour change in this PR is intentional and good. The unit tests in VerificationRan both affected tests locally (after rebuilding miniflare + wrangler from this branch) and they pass cleanly with no Unhandled Errors:
Format / lint / type-check all clean. No changeset added — the change is test-only and the existing |
…ase (#13390) Co-authored-by: Adrian Gracia <agracia@cloudflare.com> Co-authored-by: Pete Bacon Darwin <pbacondarwin@cloudflare.com>
Skip creating a local TCP proxy server for Hyperdrive bindings when SSL is not needed (sslmode disabled or not specified), connecting directly to the database instead. This avoids connection refused errors caused by firewall rules or proxy port binding issues on Windows/macOS.
Also fixes two bugs in HyperdriveProxyController:
Fixes: #11556
On Windows 10 Machine
A picture of a cute animal (not mandatory, but encouraged)