[Workers] Request redirect mode: only follow and manual are supported - #33362
stayinalive181 wants to merge 1 commit into
Conversation
Review✅ No issues found in commit Code ReviewThis code review is in beta and may not always be helpful — use your judgment. No code review issues found. ConventionsNo convention issues found. Style Guide ReviewNo style-guide issues found. CommandsOnly codeowners can run commands. Post a comment with the command to trigger it.
|
|
@stayinalive181 i am curious what you were building / what you were trying to make work when you ran into this |
irvinebroque
left a comment
There was a problem hiding this comment.
@jasnell for review
|
Thanks for taking a look. We run a control plane on Workers that registers GPU inference nodes and delivers webhooks. Those outbound calls used |
The Request page listed `error` as a valid redirect mode in both the
RequestInit option and the read-only property. workerd rejects it at
Request construction with a TypeError ("Invalid redirect value, must be
one of "follow" or "manual" ("error" won't be implemented since it does not
make sense at the edge; use "manual" and check the response status
code)."), so a Worker that passes it never sends the request. Document the
two supported values and the behaviour of `error`.
a971374 to
989fb8f
Compare
Summary
Correction to the Workers
Requestruntime API page (src/content/docs/workers/runtime-apis/request.mdx).The page currently lists
erroras a valid redirect mode in two places: theredirectoption ofRequestInitand the read-onlyredirectproperty. Workers does not implement that mode. workerd rejects it while parsing theRequestInitdictionary, insrc/workerd/api/http.c++:Because the exception is thrown when the
Requestis constructed,fetch(url, { redirect: "error" })fails before any request is sent, for every URL. Reproduced withwrangler devand on deployed Workers; the identical failure for all destinations makes it look like a network problem, which is how we lost a day to it before finding the message above.Both descriptions now say
followormanual, and explain thaterrorthrows aTypeErrorat construction and thatmanualplus a status-code check is the equivalent. A stray double space on the first line was removed at the same time.Documentation checklist