UnhandledPromiseRejectionWarning
See original GitHub issueNot sure if this is the lib error, or my code.
Express controller code:
router.get('/', (req, res, next) => {
return req.prismic.api
.query('')
.then((posts) => {
res.render('blog/index', {
title: 'Blog',
posts: posts
})
})
.catch(next)
})
Now, disable connection on the computer and try to access the route:
(node:8251) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): FetchError: request to http://foo.prismic.io/api?access_token=… failed, reason: getaddrinfo ENOTFOUND foo.prismic.io foo.prismic.io:80
(node:8251) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Getting a UnhandledPromiseRejectionWarning when testing ...
On the console I'm getting an 'UnhandledPromiseRejectionWarning' even though the reject function is getting called since it instantly shows ...
Read more >What is UnhandledPromiseRejectionWarning
The Promise.reject() method returns a Promise object that is rejected with a given reason. The unhandledrejection event is sent to the global scope...
Read more >Fixing UnhandledPromiseRejectionWarning in Node.js
If we fail to handle a Promise rejection, we're shown the UnhandledPromiseRejectionWarning by Node.js. const slowAndSteady = new Promise( ...
Read more >Unhandled Promise Rejections in Node.js - The Code Barbarian
If you want to suppress the unhandled promise rejection warning, all you need to do is call .catch() on the promise with an...
Read more >Unhandled Promise Rejection Warning - Codecademy Forums
I keep getting this error when I run my code UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I’m going to look at it.
I still get these sometimes, and don’t really have an idea on how to fix them. Build a simple script that loops over and does a request to get some data…
https://github.com/BramDecuypere/loop-over-requests
Just keep running it multiple times and you will get either of 2 responses:
Just run the linked repo in 2 seperate terminals at the same time. And one of them will get this issue. Any insights would be great!