UnhandledPromiseRejectionWarning after upgrade
See original GitHub issueI’m using the following npm packages
"@pollyjs/adapter-fetch": "^1.0.0",
"@pollyjs/core": "^1.0.0",
"@pollyjs/persister-fs": "^1.0.0",
If I try to upgrade @pollyjs/core
to 1.1.0
or higher I get the following warnings running my tests with Jest:
(node:16928) UnhandledPromiseRejectionWarning: Error: [Polly] [adapter:fetch] Unhandled request: GET http://localhost/api/gas-types/.
(node:16928) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
(node:16928) [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.
(node:16928) UnhandledPromiseRejectionWarning: Error: [Polly] [adapter:fetch] Unhandled request: GET http://localhost/api/location/.
(node:16928) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .
any ideas how to figure it out why?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
UnhandledPromiseRejectionWar...
After updating to Angular 9 to 10 and run ng serve -o. I got the following error (node:34728) UnhandledPromiseRejectionWarning: Error: spawn ...
Read more >Node.js 15 release: Updated handling of rejections, npm 7, N ...
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not...
Read more >Unhandled Promise Rejection Warning - Node-RED Forum
In terminal I have this error: (node:1946) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by ...
Read more >Migrate from v4 - Vue CLI
... UnhandledPromiseRejectionWarning: TypeError: The 'compilation' argument must be an instance of Compilation after upgrading, ...
Read more >Tips for Upgrading Node 12 LTS Quickly and Painlessly
If you see UnhandledPromiseRejectionWarning messages in your logs, then there is a chance that your Node app will crash after the upgrade.
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
I find that this issue occurs if my test finishes before the polly request completes (in my use case, I don’t care about the results of the request). I’m using
setup-polly-jest
and callingpolly.flush()
in Jest’safterEach()
setup method seems to do the trick:Closing as the issue is old and awaiting on
polly.flush()
before your tests end should resolve this for most. If there are edge cases, feel free to open a new issue with clear instructions on how to reproduce.