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-recaptcha): Support esbuild transpilation of content scripts #758

Merged
merged 1 commit into from
Feb 27, 2023

Conversation

igalklebanov
Copy link
Contributor

@igalklebanov igalklebanov commented Nov 28, 2022

This one was a real pain in the *@#^@.
But now the sun can shine once again, and the scraping can continue!

Basically, was having a blast running plugin-recaptcha locally with ts-node, and once the same code hit production aws lambdas it started throwing the mentioned error.

Long story short, it was esbuild and the way it transformed RecaptchaContentScript & HcaptchaContentScript classes into something like var HcaptchaContentScript = class {.

The fix looks for such a sequence and injects the class name back.

@github-actions github-actions bot added plugin: puppeteer-extra PuppeteerExtra Plugin related plugin: recaptcha 🏴 reCAPTCHA plugin related labels Nov 28, 2022
@igalklebanov igalklebanov changed the title fix unexpected token '{' errors @ plugin-recaptcha when using esbuild. fix unexpected token '{' errors @ plugin-recaptcha when using esbuild. Nov 28, 2022
@transitive-bullshit
Copy link
Contributor

Also running into this on https://github.com/transitive-bullshit/chatgpt-api

I ended up switching captcha providers because it wouldn't work when invoked via tsx (which uses esbuild under the hood).

@igalklebanov
Copy link
Contributor Author

I think I tried tsx too, but either it didn't work because of this issue or something with decorators. So went with ts-node because well, build is not as slow as waiting for hcaptcha provider's response.

@berstend
Copy link
Owner

berstend commented Feb 27, 2023

@igalklebanov great find 👍

I'll try to merge this in before merging #763, for attribution :)

@berstend berstend changed the title fix unexpected token '{' errors @ plugin-recaptcha when using esbuild. fix(plugin-recaptcha): Support esbuild transpilation of content scripts Feb 27, 2023
@berstend berstend merged commit b8a7724 into berstend:master Feb 27, 2023
berstend pushed a commit that referenced this pull request Feb 27, 2023
@berstend
Copy link
Owner

berstend commented Mar 1, 2023

Successfully published:
 - [email protected]

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 plugin: recaptcha 🏴 reCAPTCHA plugin related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants