UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: unexpected server response (500)
See original GitHub issueI want to do something on several tabs, so here is my code:
const CDP = require('chrome-remote-interface');
var Tab = ( function() {
process : function(url){
CDP.New({'url':url}, function (err, target) {
if (!err) {
CDP((client) => {
const {Network, Page, Runtime} = client;
Network.enable();
Page.enable();
Runtime.enable();
Page.navigate({url: URL});
....
do something
});
}
});
}
})();
function openUrl(url) {
var tab = new Tab();
tab.process(url);
}
openUrl('http://github.com');
openUrl('http://google.com');
Then error:
(node:8700) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: unexpected server response (500)
The function openUrl() will be called when there are some post requests. Therefore, I use two lines of openUrl() to represent.
I think the error may be happened when
CDP( (client) =>{
});
Is CDP() just allow being used once? How can I deal with the muli-tab problem? I need to do something on different tabs asynchronously…
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
UnhandledPromiseRejectionWar...
Error : UnhandledPromiseRejectionWarning: Unhandled promise rejection · It usually means that you're calling res. · I don't call res. · After ...
Read more >Unhandled Promise Rejections in Node.js - The Code Barbarian
Output $ node test.js (node:8383) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: exception!
Read more >Handling those unhandled promise rejections with JS async ...
One of your await ed functions fails (i.e. rejects a promise); You get the error. Another possibility is that you know you need...
Read more >500 Internal Server Error when loading tasks - GenieACS Forum
But it fails with HTTP error 500, and body content: ... To terminate the node process on unhandled promise rejection, use the CLI...
Read more >Node.js v19.3.0 Documentation
SyncWriteStream; DEP0062: node --debug; DEP0063: ServerResponse.prototype. ... doesNotReject() will return a rejected Promise with that error.
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 FreeTop 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
Top GitHub Comments
This works fine for me, can you try it?
OK, that’s because I suggested to use the
target
option which has been introduced in v0.20.0 while you were using an older release (which usestab
instead). You’re welcome!