Repository navigation
Conversation
The three static outbound accessors — outbound, outboundByHost and outboundHandlers — must be set by assignment after the class declaration. Written as `static` class fields they are installed with [[DefineOwnProperty]] under useDefineForClassFields (the default for target ES2022 and above), which shadows the inherited setter instead of invoking it. The handler is never registered and outbound requests fail closed with 520, with no error or warning. docs/egress.md already uses the assignment form in all six of its examples; README.md used the class-field form in all six of its own. This brings the README in line with the egress docs. Instance properties in the same example (allowedHosts, deniedHosts, interceptHttps, enableInternet, defaultPort) are plain properties rather than accessors, so they are correct as class fields and are unchanged. Refs cloudflare#247
…2022+ class fields never invoke the registry setters) — see cloudflare#247
|
Quick update on scope: this PR now covers all three static outbound accessors — #247 now documents a second production incident on top of the original fail-closed one: a fail-open variant where Happy to go further if preferred — I'd be glad to implement either:
(Also worth noting separately: |
What
Align
README.mdwithdocs/egress.mdon how the three static outbound accessors are set:by assignment after the class declaration, not as
staticclass fields.Fixes the documentation half of #247.
Why
outbound,outboundByHostandoutboundHandlersare declared as static accessor pairs(
dist/lib/container.d.ts:50-55), and their setters are the only writers of the handlerregistry. Under
useDefineForClassFieldssemantics — the default fortarget: ES2022andabove — a
static outbound = …class field is installed with[[DefineOwnProperty]]. Thatcreates an own property which shadows the inherited setter instead of invoking it, so the
handler is never registered and every outbound request fails closed with
520 Origin is disallowed. No error, no warning, andMyContainer.outboundstill reads backthe function you assigned — it is just the own property, not a registration.
The repo already documents this correctly elsewhere.
docs/egress.mduses the assignmentform in all six of its examples (lines 150, 165, 177, 310, 316, 322):
while
README.mduses the class-field form in all six of its own (lines 311, 315, 319, 479,485, 491). This PR makes the README match the egress docs; it does not introduce a new
convention.
All three accessors are affected identically, not just
outbound.Changes
form does not register.
staticblocks out of the class body into assignmentsafter the declaration.
Instance properties in the same example (
allowedHosts,deniedHosts,interceptHttps,enableInternet,defaultPort) are plain properties rather than accessors, so they arecorrect as class fields and are left unchanged.
Docs-only — no changeset, no behaviour change.