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

feat: use puppeteer-core instead of puppeteer #336

Closed
wants to merge 1 commit into from

Conversation

ratson
Copy link

@ratson ratson commented Sep 24, 2020

This should address #262 #27 #30 #66

It seems this package is the puppeteer types rather than its functionality to download browser.

@berstend
Copy link
Owner

berstend commented Sep 27, 2020

Hey @ratson - unfortunately @types/puppeteer-core is severely outdated :-/

This issue should be fixed in the upcoming #303 rewrite regardless, as I've ditched the peer dependencies (packages/automation-extra/package.json): https://github.com/berstend/puppeteer-extra/pull/303/files#diff-9796a6dfb75df90c2755fd54e3641cafR54-R61

Closing this PR for now, but thanks for the initiative!

@berstend berstend closed this Sep 27, 2020
@AdrKacz
Copy link

AdrKacz commented Sep 25, 2023

Hello, what are the options to use puppeteer-extra only with puppeteer-core? (Without downloading any browser)

@bjornlll
Copy link

bjornlll commented Dec 31, 2024

@AdrKacz if you have puppeteer-core installed alongside this package it should automagically work. However, on my side it doesn't (esbuild + puppeteer-core + this package). Will let you know if I find out what the issue is.

@bjornlll
Copy link

Solved by, in esbuild, marking the models as external and manually npm installing them into the bundle.

@AdrKacz
Copy link

AdrKacz commented Dec 31, 2024

@bjornlll can you please share the config files that you found to resolve the issue?

@bjornlll
Copy link

bjornlll commented Dec 31, 2024

Sure, but it likely won't be relevant.

sst.config.ts

const ingestDocFnParams: Omit<sst.aws.FunctionArgs, 'handler'> = {
    // ...
    nodejs: {
      install: {
        // This marks the the packages as 'external' to esbuild and manually npm installs them
        "jsdom": "npm:[email protected]",
        "@sparticuz/chromium": "131.0",
        "sharp": "*",
        "puppeteer-core": "^23.10.4",
        "puppeteer-extra": "^3.3.6",
        "puppeteer-extra-plugin-stealth": "^2.11.2",
      }
    },
  };

This solution is specific to esbuild + SST. A similar solution would probably work if you're using another bundler (webpack, vite, ...). Key is to exclude the packages from the bundle and npm install them instead.

@AdrKacz
Copy link

AdrKacz commented Jan 1, 2025

I'm also working with esbuild + SST so it might help more than you think ☺️
Thank you very much, I'll give it a try !

@bjornlll
Copy link

bjornlll commented Jan 1, 2025

Haha! Great to hear. Then you should also know that I had to patch SST to make this work: https://github.com/bjornlll/sst. Submitted a PR to them. Not sure if/when they'll merge: sst/sst#5270

As an alternative you can also use the sst.aws.Function's bundle property to provide your own bundling logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants