question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read properties of undefined (reading 'Symbol(Body internals)')

See original GitHub issue

Reproduction

This works

const response = await fetch(`https://google.com/`);
await response.text();

while the syntatically equivalent

const {text} = await fetch(`https://google.com/`);
await text();

fails with TypeError: Cannot read properties of undefined (reading 'Symbol(Body internals)').

Expected behavior

Both code blocks should work as they are syntactically equivalent. It might be related to NodeJS primordials, see NodeJS Issue #36364.

Your Environment

software version
node-fetch 3.2.10
node v18.9.0
npm 8.19.1
Operating System MacOS x64

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
leehambleycommented, Nov 30, 2022

Thanks for the comprehensive response @jimmywarting - I learned a lot. Of course losing the binding context makes sense here, and the error as presented did’t immediately make sense, but after reading your notes, it’s perfectly understandable. Thanks also for the reading suggestions and thorough explanation through code snippets.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot make a node-fetch request, TypeError ... - GitHub
Cannot make a node-fetch request, TypeError: Cannot read property 'Symbol(requestOptions)' of undefined #36364.
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Why the error for Promise.all?: TypeError: Cannot read ...
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined.
Read more >
How to Avoid the Infamous "Cannot read properties of ... - Bitovi
That error message is telling you the function is returning undefined implicitly, but its return type does not include undefined in it. Awesome!...
Read more >
How to Fix TypeError: Cannot read Property 'push' of ...
You call the method on a variable previously set to undefined . · You call the method on a variable before it has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found