Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-user-data-dir): Use rimraf to delete temp userDataDir #656

Merged
merged 4 commits into from Jul 8, 2022
Merged

fix(plugin-user-data-dir): Use rimraf to delete temp userDataDir #656

merged 4 commits into from Jul 8, 2022

Conversation

thibaultmthh
Copy link
Contributor

@thibaultmthh thibaultmthh commented Jun 22, 2022

Fixes: #581, #601

The current solution was failing sometimes to delete the directory because some files were still used by chrome.
Also this issue was causing the process to freeze

Ex :
Error: EPERM: operation not permitted, unlink 'C:\Users\Moi\AppData\Local\Temp\puppeteer_dev_profile-KKPhhn\BrowserMetrics\BrowserMetrics-62B2BDF7-4CE8.pma

Using rimraf allows better error logging and does not freeze the process.

Link to discord discussion https://discord.com/channels/737009125862408274/737010839172939898/988781077885763614

@github-actions github-actions bot added the plugin: puppeteer-extra PuppeteerExtra Plugin related label Jun 22, 2022
@thibaultmthh
Copy link
Contributor Author

I also changed the test workflow so we can start it manually without creating a pull request

@berstend berstend changed the title fix(plugin-user-data-dir) Use rimraf to delete temp userDataDir fix(plugin-user-data-dir): Use rimraf to delete temp userDataDir Jul 8, 2022
@berstend
Copy link
Owner

berstend commented Jul 8, 2022

Successfully published:
 - extract-stealth-evasions@2.7.0
 - puppeteer-extra-plugin-stealth@2.11.0
 - puppeteer-extra-plugin-user-data-dir@2.4.0
 - puppeteer-extra-plugin-user-preferences@2.4.0

thanks @thibaultmthh 👍

@zebn
Copy link

zebn commented Jul 10, 2022

Still have this issue with rimraf when running multiple instances of puppeteer, and can't catch it with browser.close().catch:

"extract-stealth-evasions": "^2.7.0",
"puppeteer-extra-plugin-stealth": "^2.11.0",
"puppeteer-extra-plugin-user-data-dir": "^2.4.0",
"puppeteer-extra-plugin-user-preferences": "^2.4.0",
"puppeteer-extra": "3.3.4"

AssertionError [ERR_ASSERTION]: rimraf: missing path at rimraf (/root/pbot-lin/node_modules/rimraf/rimraf.js:54:3) at Plugin.deleteUserDataDir (/root/pbot-lin/node_modules/puppeteer-extra-plugin-user-data-dir/index.js:71:5) at Plugin.onDisconnected (/root/pbot-lin/node_modules/puppeteer-extra-plugin-user-data-dir/index.js:118:12) at /root/pbot-lin/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js:51:68 at Array.map (<anonymous>) at Object.emit (/root/pbot-lin/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js:51:43) at Browser.emit (/root/pbot-lin/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:72:22) at /root/pbot-lin/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js:141:25 at /root/pbot-lin/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js:51:68 at Array.map (<anonymous>) { generatedMessage: false, code: 'ERR_ASSERTION', actual: undefined, expected: true, operator: '==' }

@berstend
Copy link
Owner

berstend commented Jul 15, 2022

@zebn are you using addExtra as mentioned in the readme? Otherwise you're using the same puppeteer instance which can cause problems

@antfuentes87
Copy link

@zebn are you using addExtra as mentioned in the readme? Otherwise you're using the same puppeteer instance which can cause problems

I am tried using addExtra and got the same issue with rimraf. Is there anything else you have to do? I am trying to run 20+ puppeteers at the same time using express.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: puppeteer-extra PuppeteerExtra Plugin related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] puppeteer-extra-plugin:user-data-dir.onDisconnected hangs when trying to delete a profile.
4 participants