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.

Node internal uncaughtException

See original GitHub issue

Describe the bug When i want to get body of response i get this error

node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

immediate._onImmediate: Protocol error (Network.getResponseBody): No resource with given identifier found
    at processImmediate (node:internal/timers:464:21)
    at process.callbackTrampoline (node:internal/async_hooks:130:17) {
  name: 'Error'
}
error Command failed with exit code 1.

To Reproduce

 await page.on('response', async (r) => {
                if (r.url().includes('hoteldetail/rooms/')) {
                    const text = await r.text();
                    log.info(r.url());
                }
            });

Expected behavior Get respone body as a text.

System information:

  • OS: [e.g. Linux Ubuntu]
  • Node.js version [e.g. 16.6]
  • Apify SDK version [e.g. 2.0.7]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mnmkngcommented, Oct 4, 2021

Closing since this was most likely unrelated to the SDK.

1reaction
pocesarcommented, Sep 10, 2021

@laster04 never throw inside EventListeners as they are synchronous and don’t await the listener callbacks. If you must, you can use a deferred to throw a promise from inside, you need a try/catch there https://github.com/pocesar/actor-facebook-scraper/blob/ac6229408cb96bd46b19daa2164b4b6fb6286c4d/src/page.ts#L339-L353

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught exceptions in Node.js | Joyee Cheung's Blog
In this post, I'll jot down some notes that I took when refactoring the uncaught exception handling routines in Node.js.
Read more >
Node.js Process uncaughtException Event - GeeksforGeeks
The 'uncaughtException' is an event of class Process within the process module which is emitted when an uncaught JavaScript exception bubbles ...
Read more >
Nodejs uncaughtException event not fired if exception ...
Nodejs uncaughtException event not fired if exception occurred inside express handler ; What happens if you move someInvalidFunc(); below the app ...
Read more >
Process | Node.js v19.3.0 Documentation
The 'uncaughtException' event is emitted when an uncaught JavaScript exception ... In this example, an Error object is generated internally by process.
Read more >
Uncaught errors in Node.js and the browser
This article looks into what happens with unhandled errors both in Node.js and in the browser.
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