GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: do not throw unhandled exception when data is undefined in interceptor.reply by frederikprijck · Pull Request #4036 · nodejs/undici

Conversation

@frederikprijck

@frederikprijck frederikprijck commented Jan 31, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This relates to...

N/A

Rationale

See below (Bug Fixes)

Changes

See below (Bug Fixes)

Features

N/A

Bug Fixes

When interceptor.reply would return { data: undefined }, it blows up in getResponseData:

TypeError [Error]: Cannot read properties of undefined (reading 'toString')
      at getResponseData (/Users/frederikprijck/Development/frederikprijck/undici/lib/mock/mock-utils.js:128:17)
      at TestContext.<anonymous> (/Users/frederikprijck/Development/frederikprijck/undici/test/mock-utils.js:180:26)
      at Test.runInAsyncScope (node:async_hooks:206:9)
      at Test.run (node:internal/test_runner/test:639:25)
      at Suite.processPendingSubtests (node:internal/test_runner/test:382:18)
      at Test.postRun (node:internal/test_runner/test:730:19)
      at Test.run (node:internal/test_runner/test:688:12)
      at async Suite.processPendingSubtests (node:internal/test_runner/test:382:7)

This got introduced here, more specifcally, this change

image

More specifically, in the before and after, data is not the same when it was undefined originally:

const { statusCode, data = '', responseOptions = {} } = {data: undefined}
console.log(data); // ''

vs

const replyParameters = { data: '', responseOptions: {}, ...{data: undefined} }
console.log(replyParameters.data) // undefined

As previously, when data was undefined, '' would be passed to getResponseData, and getResponseData would return '', I ensured we now also return '' when data being passed to getResponseData is undefined.

Breaking Changes and Deprecations

N/A

Status

  • I have read and agreed to the Developer's Certificate of Origin
  • Tested
  • Benchmarked (optional)
  • Documented
  • Review ready
  • In review
  • Merge ready

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@frederikprijck
fix: do not throw unhandled exception when data is undefined in inter…
2b694cc
…ceptor.reply
metcoder95
metcoder95 approved these changes Feb 2, 2025
View reviewed changes
mcollina
mcollina approved these changes Feb 2, 2025
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

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.

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mcollina

mcollina commented Feb 2, 2025

Copy link
Copy Markdown
Member

CI seems failing

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@frederikprijck

frederikprijck commented Feb 3, 2025

Copy link
Copy Markdown
Contributor Author

I am not sure the CI failure relates to my changes? Or at least, it isn't clear for me that it would. Any pointers?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@metcoder95

metcoder95 commented Feb 4, 2025

Copy link
Copy Markdown
Member

Failures seems unrelated, are the same ones failing in other PRs (e.g. #4044)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@metcoder95
Merge branch 'main' into main
08c4c24
@frederikprijck

frederikprijck commented Feb 7, 2025

Copy link
Copy Markdown
Contributor Author

Hey @mcollina and @metcoder95, is there anything I can do to help progress this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcollina

mcollina commented Feb 8, 2025

Copy link
Copy Markdown
Member

It seems windows CI is utterly broken. I'm not keen on landing any changes until that's sorted, and I haven't had time yet.

frederikprijck reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@frederikprijck

frederikprijck commented Feb 8, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

No worries at all. I entirely understand and I am not rushed in getting this out (we have worked around the behavior in our code-base, and don't need this change to unblock ourselves. I mainly just wanted to solve this for others that may encounter it). Just trying to follow up.

Take your time, I might drive by to follow up a few times, with no bad intentions to put any kind of pressure to land this, I entirly understand and appreciate you even willing to put the time to look into this eventually.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@frederikprijck
Merge branch 'nodejs:main' into main
490f73a
mcollina
mcollina approved these changes Feb 16, 2025
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

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.

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mcollina
mcollina merged commit c14781c into nodejs:main Feb 16, 2025
@github-actions github-actions Bot mentioned this pull request Feb 28, 2025
[Release] v7.4.0 #4071
Merged
@github-actions github-actions Bot mentioned this pull request Mar 12, 2025
[Release] v6.21.2 #4092
Closed
ronag added a commit to nxtedition/undici that referenced this pull request Mar 14, 2025
@ronag
Merge remote-tracking branch 'nodejs/main'
cd214d4
* nodejs/main: (23 commits)
  Bumped v7.5.0 (nodejs#4091)
  Removed clients with unrecoverable errors from the Pool (nodejs#4088)
  feat: Allow disabling autoSelectFamily in an Agent (nodejs#4070)
  chore: update cache tests (nodejs#4027)
  fix: Fix retry-handler.js when retry-after header is a Date (nodejs#4084)
  feat: add mock call history to access request configuration in test (nodejs#4029)
  feat(docs): button to switch dark and light mode (nodejs#4044)
  Bumped v7.4.0 (nodejs#4071)
  fix: fix EnvHttpProxyAgent for the Node.js bundle (nodejs#4064)
  chore: update WPT (nodejs#4062)
  chore: update WPT (nodejs#4028)
  fix: handle missing vary header values (nodejs#4031)
  fix: do not throw unhandled exception when data is undefined in interceptor.reply (nodejs#4036)
  test: fix windows wpt (nodejs#4050)
  feat: mark `EnvHttpProxyAgent` as stable (nodejs#4049)
  don't check AbortSignal maxListeners on some node versions (nodejs#4045)
  feat(docs): copy to clipboard button (nodejs#4037)
  docs: fix incorrect method signature of `onResponseError` (nodejs#4030)
  docs: document about global dispatcher and errors (nodejs#3987) (nodejs#4014)
  chore: update WPT (nodejs#4011)
  ...
@github-actions github-actions Bot mentioned this pull request May 12, 2025
[Release] v6.21.3 #4211
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@metcoder95 metcoder95 metcoder95 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@frederikprijck @mcollina @metcoder95
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.