-
-
Notifications
You must be signed in to change notification settings - Fork 35
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(server): Request.url access error on Bun & Express #2117
base: master
Are you sure you want to change the base?
Conversation
Warning Rate limit exceeded@ardatan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 14 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThis pull request introduces a patch for the Changes
Sequence Diagram(s)sequenceDiagram
participant T as Test Case
participant E as Express App
participant A as Server Adapter
participant U as normalizeNodeRequest (Utils)
participant B as Bun Environment Check
T->>E: Send POST /my-path with JSON payload
E->>A: Forward request to adapter
A->>U: Invoke normalizeNodeRequest
U->>B: Check if globalThis.Bun is truthy
B-->>U: Confirm Bun environment detected
U-->>A: Return property via Reflect.get workaround
A-->>E: Process normalized request
E-->>T: Respond with JSON (body and URL)
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@whatwg-node/promise-helpers |
1.2.1-alpha-20250228112106-3b978aa26e4b784701bfa3cbddb050861d5a1d7c |
npm ↗︎ unpkg ↗︎ |
@whatwg-node/server |
0.9.71-alpha-20250228112106-3b978aa26e4b784701bfa3cbddb050861d5a1d7c |
npm ↗︎ unpkg ↗︎ |
✅
|
✅
|
✅
|
✅
|
✅
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/server/test/reproductions.spec.ts (1)
7-8
: Add a descriptive comment about the test purpose.Adding a comment explaining that this test specifically verifies the fix for the Bun issue would improve clarity.
-it('bun issue#12368', async () => { +/** + * This test verifies the fix for Bun issue #12368 where Request.url getter fails + * when used with Express due to incorrect Proxy.get receiver handling in Bun. + * See: https://github.com/oven-sh/bun/issues/12368 + */ +it('bun issue#12368', async () => {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.changeset/three-shirts-make.md
(1 hunks)packages/server/src/utils.ts
(1 hunks)packages/server/test/reproductions.spec.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: unit / node 23
- GitHub Check: unit / node 22
- GitHub Check: unit / node 20
- GitHub Check: unit / node 18
- GitHub Check: e2e / azure-function
🔇 Additional comments (2)
.changeset/three-shirts-make.md (1)
1-7
: LGTM!The changeset file correctly describes the purpose of the patch for
@whatwg-node/server
, addressing the specific error that occurs when using Express on Bun.packages/server/src/utils.ts (1)
176-180
: Appropriate workaround for the Bun issue.The implementation correctly addresses the Bun-specific issue by bypassing the receiver parameter when running in the Bun environment. The comment clearly references the GitHub issue for future reference.
Consider adding a TODO comment indicating that this workaround can be removed once Bun fixes issue #12368, to ensure this code doesn't remain longer than necessary.
- if (globalThis.Bun) { - // workaround for https://github.com/oven-sh/bun/issues/12368 - // Proxy.get doesn't seem to get `receiver` correctly - return Reflect.get(target, prop); - } + if (globalThis.Bun) { + // workaround for https://github.com/oven-sh/bun/issues/12368 + // Proxy.get doesn't seem to get `receiver` correctly + // TODO: Remove this workaround once Bun fixes the issue + return Reflect.get(target, prop); + }
Workaround for a potential bug in Bun itself, this might cause issues if the created Proxy's methods are used within another scope/
this
, but most of cases are fine. So the change is applied only for Bun.Fixes oven-sh/bun#12368 (comment)
Fixes dotansimha/graphql-yoga#3446
It seems Bun doesn't pass the right
receiver
in Proxy.get soReflect.get
'sreceiver
doesn't work properlySummary by CodeRabbit
Bug Fixes
Tests