phantombuster / nickjs

Web scraping library made by the Phantombuster team. Modern, simple & works on all websites. (Deprecated)
https://nickjs.org
ISC License
500 stars 48 forks source link

I have a lot of same error[you may have forgotten to catch a Promise rejection] #71

Closed allgrowsm closed 4 years ago

allgrowsm commented 4 years ago

Dear sir,

I just noticed I got lots of the same errors like following.

You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection: Error: cannot do this while another tab method is already running, each tab can execute only one action at a time at Tab._callToTabDriver (/var/vhost/api-nodejs-listing/node_modules/nickjs/lib/es8/Tab.js:50:10) at Tab.close (/var/vhost/api-nodejs-listing/node_modules/nickjs/lib/es8/Tab.js:82:15) at then.catch (/var/vhost/api-nodejs-listing/rest.js:114:8) at

Do I have to handle it myself?

Or can I just ignore it?

Best regards,

paps commented 4 years ago

Hi,

You can handle it yourself. But this particular exception, "cannot do this while another tab method is already running", should never happen. It means you're not waiting for an action done with a tab to finish. NickJS does not work that way, you have to execute actions sequentially per tab.

spearmootz commented 4 years ago

@paps i actually have the same issue. it doesnt happen all the time so i just let it crash and retry.

and for example if i have an issue and i want to debug i would want to be able to see what is happening. so typically if i set a breakpoint in a program i can run commands to inquire, with Nick i would want to take a screenshot.

const tab = await nick.newTab(); await tab.open(dcfProviderViewUrl); await tab.waitUntilVisible(referenceTypeSelector);

so in this case if i break in the last await, meaning it was not executed yet and i type into the console tab.screenshot() the error above shows up. even though i awaited for the open command and i know nothing else is running because its "paused".

paps commented 4 years ago

Huh, that's weird. Can you console.log() tab.actionInProgress? This is the internal boolean that is set to true when an action begins and re-set to false when the action is done