Makepad-fr / fbjs

Tooling that automates your Facebook interactions.
https://www.npmjs.com/package/@makepad/fbjs
GNU General Public License v3.0
63 stars 24 forks source link

Error when running script with credentials #26

Closed assafelovic closed 3 years ago

assafelovic commented 3 years ago
  1. Everything is installed correctly (version 2.3.2)
  2. Added credentials (fgps init)

Running with this example: fgps --group-ids 196322762283544 --output /path

get this error:

(node:45896) UnhandledPromiseRejectionWarning: TimeoutError: waiting for XPath "//button[@data-cookiebanner="accept_button"]" failed: timeout 30000ms exceeded at new WaitTask (/Users/assafelovic/.nvm/versions/node/v12.9.1/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:549:28) at DOMWorld._waitForSelectorOrXPath (/Users/assafelovic/.nvm/versions/node/v12.9.1/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:478:22) at DOMWorld.waitForXPath (/Users/assafelovic/.nvm/versions/node/v12.9.1/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:441:17) at Frame.waitForXPath (/Users/assafelovic/.nvm/versions/node/v12.9.1/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/FrameManager.js:642:47) at Frame.<anonymous> (/Users/assafelovic/.nvm/versions/node/v12.9.1/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/helper.js:112:23) at Page.waitForXPath (/Users/assafelovic/.nvm/versions/node/v12.9.1/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/Page.js:1131:29) at facebookLogIn (/Users/assafelovic/.nvm/versions/node/v12.9.1/lib/node_modules/facebook-group-posts-scraper/src/index.js:331:14) at processTicksAndRejections (internal/process/task_queues.js:85:5) at async main (/Users/assafelovic/.nvm/versions/node/v12.9.1/lib/node_modules/facebook-group-posts-scraper/src/index.js:608:10) (node:45896) 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: 1) (node:45896) [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.

gohjiayi commented 3 years ago

Same error faced here please help! Seems to be similar to Issue #13 which has been closed. Appreciate the codes that you guys built and hope to be able to leverage on it!

C:\Users\Jiayi\Documents>fgps --group-ids 859169247578150 --output C:/Users/Jiayi/Desktop
(node:4396) UnhandledPromiseRejectionWarning: TimeoutError: waiting for XPath "//button[@data-cookiebanner="accept_button"]" failed: timeout 30000ms exceeded
    at new WaitTask (C:\Users\Jiayi\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\node_modules\puppeteer\lib\DOMWorld.js:549:28)
    at DOMWorld._waitForSelectorOrXPath (C:\Users\Jiayi\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\node_modules\puppeteer\lib\DOMWorld.js:478:22)
    at DOMWorld.waitForXPath (C:\Users\Jiayi\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\node_modules\puppeteer\lib\DOMWorld.js:441:17)
    at Frame.waitForXPath (C:\Users\Jiayi\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\node_modules\puppeteer\lib\FrameManager.js:642:47)
    at Frame.<anonymous> (C:\Users\Jiayi\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\node_modules\puppeteer\lib\helper.js:112:23)
    at Page.waitForXPath (C:\Users\Jiayi\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\node_modules\puppeteer\lib\Page.js:1131:29)
    at facebookLogIn (C:\Users\Jiayi\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\src\index.js:331:14)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:4396) 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: 1)
(node:4396) [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.
kaanyagci commented 3 years ago

Hi @gohjiayi & @assafelovic ,

Sorry for the late response! And thank you very much for your contributions. It seems like in your location the cookie banner does not appear. I pushed some changes on the gh-26 branch can you please check if it works?

hamhamhammchamm commented 3 years ago

Getting the same error as well.

wgicio commented 3 years ago

Getting the same error as well.

kaanyagci commented 3 years ago

@hamhamhammchamm @wgicio Can you try with the branch gh-26? We were waiting for confirmation before merging and deploying it.

fredzannarbor commented 3 years ago

tried on branch gh-26, still got same error

04963 --output gpt3group (node:14929) UnhandledPromiseRejectionWarning: TimeoutError: waiting for XPath "//button[@data-cookiebanner="accept_button"]" failed: timeout 30000ms exceeded at new WaitTask (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:549:28) at DOMWorld._waitForSelectorOrXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:478:22) at DOMWorld.waitForXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:441:17) at Frame.waitForXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/FrameManager.js:642:47) at Frame. (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/helper.js:112:23) at Page.waitForXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/Page.js:1131:29) at facebookLogIn (/usr/local/lib/node_modules/facebook-group-posts-scraper/src/index.js:331:14) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async main (/usr/local/lib/node_modules/facebook-group-posts-scraper/src/index.js:608:10) (node:14929) 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: 1) (node:14929) [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.

hamhamhammchamm commented 3 years ago

Same as above, tried it again and still got the same error.

wgicio commented 3 years ago

`macca@macca:~$ fgps --group-ids 1775258645956385 --output /home/macca/Documents (node:28974) UnhandledPromiseRejectionWarning: TimeoutError: waiting for XPath "//button[@data-cookiebanner="accept_button"]" failed: timeout 30000ms exceeded at new WaitTask (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:549:28) at DOMWorld._waitForSelectorOrXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:478:22) at DOMWorld.waitForXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:441:17) at Frame.waitForXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/FrameManager.js:642:47) at Frame. (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/helper.js:112:23) at Page.waitForXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/Page.js:1131:29) at facebookLogIn (/usr/local/lib/node_modules/facebook-group-posts-scraper/src/index.js:331:14) at process._tickCallback (internal/process/next_tick.js:68:7) (node:28974) 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: 1) (node:28974) [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.

`

kaanyagci commented 3 years ago

Thank you, @fredzannarbor @hamhamhammchamm and @wgicio, for your responses. And I'm sorry for that issue persisted. I just double-checked, and there was a syntax error on the try/catch block that I've added. I fixed the syntax error and pushed 5384cba on the gh-26. This will hopefully fix the issue. Please test with the latest version of the gh-26 branch and tell me if it works.

Again, I can not test on my own as in Europe, the cookie banner appears.

hamhamhammchamm commented 3 years ago

Thank you, @fredzannarbor @hamhamhammchamm and @wgicio, for your responses. And I'm sorry for that issue persisted. I just double-checked, and there was a syntax error on the try/catch block that I've added. I fixed the syntax error and pushed 5384cba on the gh-26. This will hopefully fix the issue. Please test with the latest version of the gh-26 branch and tell me if it works.

Again, I can not test on my own as in Europe, the cookie banner appears.

Hi, I am getting a different error this time,

UnhandledPromiseRejectionWarning: Error: Browser is not downloaded. Run "npm install" or "yarn install"

I installed puppeteer and chromium already but seems I'm getting the same error.

kaanyagci commented 3 years ago

Hi @hamhamhammchamm ,

This is weird I'll take a deeper look into it. Are you running on an AWS Lambda? Also, did you try to Install the puppeteer instance globally with sudo npm install puppeteer --unsafe-perm=true --allow-root maybe it can help

wgicio commented 3 years ago

macca@macca:~$ fgps init ? facebook username: xxxxxx ? password: [hidden] macca@macca:~$ fgps --group-ids 1775258645956385 --output /home/macca/Documents Cookie banner did not appear

kaanyagci commented 3 years ago

Hi @wgicio,

The "Cookie banner did not appear" will be removed when released. But if you are having this log, the issue is fixed, right? Once you confirm, I'll publish the new version with this fix.

hamhamhammchamm commented 3 years ago

Hi @hamhamhammchamm ,

This is weird I'll take a deeper look into it. Are you running on an AWS Lambda? Also, did you try to Install the puppeteer instance globally with sudo npm install puppeteer --unsafe-perm=true --allow-root maybe it can help

No not using AWS Lambda. I have installed puppeteer that way but did not work.

Here's the full error for your reference.

(node:3248) UnhandledPromiseRejectionWarning: Error: Browser is not downloaded. Run "npm install" or "yarn install" at ChromeLauncher.launch (C:\Users\xx\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\node_modules\puppeteer\lib\Launcher.js:236:15) at async createBrowser (C:\Users\xx\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\src\index.js:262:19) at async main (C:\Users\xx\AppData\Roaming\npm\node_modules\facebook-group-posts-scraper\src\index.js:605:19) (Usenode --trace-warnings ...to show where the warning was created) (node:3248) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:3248) [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.

kaanyagci commented 3 years ago

Hi @hamhamhammchamm ,

I'll try to check this before the end of the day.

kaanyagci commented 3 years ago

@hamhamhammchamm just checked again. It seems like the issue is related to bundled chromium which came with the puppeteer. Using Google Chrome instead of bundled chromium can be a workaround:

const browser = await puppeteer.launch({
    executablePath: '/full/path/to/chrome'
});

Also, you can use the fbjs-container.

kaanyagci commented 3 years ago

This issue is closed as I assume the main issue related to the cookie banner is resolved. Feel free to reopen it if the issue persists.

fredzannarbor commented 3 years ago

Not resolved for me. I am only doing this:

fred@Freds-MacBook-Pro:~/bin/nimble/fbjs$ !1958

**fgps --group-ids 781481526004963 --output gpt3group**
(node:8860) UnhandledPromiseRejectionWarning: TimeoutError: waiting for XPath "//button[@data-cookiebanner="accept_button"]" failed: timeout 30000ms exceeded
    at new WaitTask (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:549:28)
    at DOMWorld._waitForSelectorOrXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:478:22)
    at DOMWorld.waitForXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/DOMWorld.js:441:17)
    at Frame.waitForXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/FrameManager.js:642:47)
    at Frame.<anonymous> (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/helper.js:112:23)
    at Page.waitForXPath (/usr/local/lib/node_modules/facebook-group-posts-scraper/node_modules/puppeteer/lib/Page.js:1131:29)
    at facebookLogIn (/usr/local/lib/node_modules/facebook-group-posts-scraper/src/index.js:331:14)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async main (/usr/local/lib/node_modules/facebook-group-posts-scraper/src/index.js:608:10)
(node:8860) 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: 1)
(node:8860) [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.
kaanyagci commented 3 years ago

@fredzannarbor

Did you test with the version 2.4.0 that I've recently deployed on npm?

wgicio commented 3 years ago

it works, thanks!

kaanyagci commented 3 years ago

You're welcome! As confirmed I'll close the issue. Feel free to re-open or open an other issue

fredzannarbor commented 3 years ago

thanks!

On Sat, Mar 27, 2021 at 5:15 PM Kaan Yagci @.***> wrote:

You're welcome! As confirmed I'll close the issue. Feel free to re-open or open an other issue

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Makepad-fr/fbjs/issues/26#issuecomment-808803332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI4TS3VV5QJAGNAKDVS3OTTFZDGDANCNFSM4YQ2GPGA .