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 issue with node envs (must explicitly set duplex option on Request constructror) #152

Merged
merged 6 commits into from
Aug 20, 2024

Conversation

brettimus
Copy link
Contributor

@brettimus brettimus commented Aug 19, 2024

Alright. So. In environments that use node/undici, we need to conform to specifications APPARENTLY.


The fetch specification is in a weird spot.

Technically, when the body of a RequestInit is a ReadableStream, you MUST specify the property duplex: "half"

There will be future support for duplex: "full", however this is not yet exposed.

So really, the only option for duplex is "half" but we need to use it explicitly for future compatibility.

Copy link

pkg-pr-new bot commented Aug 19, 2024

commit: d2fa57b

pnpm add https://pkg.pr.new/fiberplane/fpx/@fiberplane/studio@152
pnpm add https://pkg.pr.new/fiberplane/fpx/@fiberplane/hono-otel@152

Open in Stackblitz

@brettimus brettimus changed the title Fix issue with node envs (must explicitly set duplex option on Request constructror0 Fix issue with node envs (must explicitly set duplex option on Request constructror) Aug 19, 2024
@brettimus
Copy link
Contributor Author

tested by Nele on her/oscar's bun project, where the issue first came up

@brettimus brettimus requested a review from flenter August 19, 2024 15:14
@brettimus brettimus force-pushed the fp-4001-fiberplanehono-otel-breaks-when-running-bun branch from 7c9d9e1 to 0696491 Compare August 19, 2024 16:21
Copy link
Member

@oscarvz oscarvz left a comment

Choose a reason for hiding this comment

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

Can confirm it works on the bun project 👍

@brettimus brettimus force-pushed the fp-4001-fiberplanehono-otel-breaks-when-running-bun branch from 0696491 to d2fa57b Compare August 20, 2024 10:12
@brettimus brettimus merged commit 919431f into main Aug 20, 2024
3 checks passed
@brettimus brettimus deleted the fp-4001-fiberplanehono-otel-breaks-when-running-bun branch August 20, 2024 10:44
Copy link
Member

@flenter flenter left a comment

Choose a reason for hiding this comment

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

Oh it's been merged 😅 I didn't finish my review fast enough . I noticed one small thing though

@@ -660,3 +660,13 @@ function FailedWebsocket() {
</div>
);
}

const safeParseJson = (jsonString: string) => {
Copy link
Member

Choose a reason for hiding this comment

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

There's already an eerily similar exact same safeParseJson function in src/utils/index.ts. Why not import & use that?

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.

3 participants