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.

You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:

Error: Not Found
    at Request.callback (../node_modules/superagent/lib/node/index.js:674:11)
    at ../node_modules/superagent/lib/node/index.js:881:18
    at IncomingMessage.<anonymous> (../node_modules/superagent/lib/node/parsers/json.js:16:7)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:122:9)

I sometimes get this error and I really dont know where it comes from I am in the latest version 3.5.1

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kornelskicommented, Apr 19, 2017

Please note that await syntax is a different thing, and it’s not related to the original question about “unhandledRejection”.

You don’t need .then() if you’re using async/await.

const response = await request
        .get(url)
        .set(headers);
t.is(response.status, 404);
0reactions
kornelskicommented, Jul 13, 2018

BTW: You never need to use new Promise when interacting with libraries that support promises (including superagent). new Promise is only for legacy callback-based libraries. This code is the same as your exaple:

request
        .post(url)
        .set({'Content-Type': 'application/json', 'X-Authorization': key})
        .send({ k: v })
        .then(res => {
            return res.body;
        })
Read more comments on GitHub >

github_iconTop Results From Across the Web

404 Page Not Found Error: What It Is and How to Fix It - Lifewire
A 404 error is an HTTP status code that means that the page you were trying to reach on a website couldn't be...
Read more >
Error 404 not found - What does it mean & how to fix it! - IONOS
Something along the lines of '404 Not Found'. A 404 error is the standardized HTTP status code. The message is sent from the...
Read more >
HTTP 404 - Wikipedia
In computer network communications, the HTTP 404, 404 not found, 404, 404 error, page not found or file not found error message is...
Read more >
How to Fix Error 404 Not Found on Your WordPress Site - Kinsta
The Internet Engineering Task Force (IETF) defines the error 404 Not Found as: The 404 (Not Found) status code indicates that the origin...
Read more >
What Does Error 404 Not Found Mean? - SEMrush
What Are 404 Errors? ... A 404 error is when a website's server can't find the page you're trying to access via a...
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