Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XRPC fetch usage for newly required duplex option #470

Merged
merged 1 commit into from
Jan 18, 2023
Merged

Conversation

devinivy
Copy link
Collaborator

@devinivy devinivy commented Jan 17, 2023

As of node v18.13.0 a change to the fetch spec is now reflected in node's fetch implementation. In short, for streaming request bodies the option duplex: 'half' must explicitly be passed to fetch(). Part of the trickiness here is that this change to the spec is not reflected in docs such as MDN yet, nor in Typescript's lib.dom types.

Refs:
Issue as surfaced in node: nodejs/node#46221
Spec discussion: whatwg/fetch#1438
Implementation in node: nodejs/undici#1681
Docs on duplex: https://fetch.spec.whatwg.org/#ref-for-dom-requestinit-duplex
Use node's types for fetch rather than typescript's lib.dom: DefinitelyTyped/DefinitelyTyped#60924

Copy link
Collaborator

@dholms dholms left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this so quickly 👌

@devinivy devinivy merged commit 119cb3f into main Jan 18, 2023
@devinivy devinivy deleted the fix-xrpc-fetch branch January 18, 2023 22:18
mloar pushed a commit to mloar/atproto that referenced this pull request Nov 15, 2023
…#470)

Fix xrpc fetch usage for newly required duplex option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants