Skip to content

Conversation

@lowlighter
Copy link
Contributor

@lowlighter lowlighter commented Nov 25, 2025

This PR adds two new presets:

  • containerized: for containers images (e.g. Docker)
  • lambdaInstance: for AWS lamda-like environements (e.g. Vercel).

The former is just a convenience alias, since chromium sandboxing must almost always be disabled with docker.
Maybe we could also default --user-data-dir=/tmp too with this preset.

The latter might interest a lot of people (and might be worth being documented in a future iteration) and offers the flags required to launch chromium on AWS lambda-like environements, such as serverless services like Vercel.

The following link shows a proof of concept of using deno + astral + chrome + vercel:
https://vercel-deno-runtime.vercel.app/#lambda_chromium.ts

There is however a small subtility though.
These environement are resources tight so you need to use a trimmed down version of chromium (like Sparticuz/chromium, which is a fork of the unmaintained alixaxel/chrome-aws-lambda) that has been compiled specifically for it, in addition to add extra optimizations flags to make it faster.

It means that you cannot use the astral downloader for it, so I created a small tool for it jsr:@libs/toolbox/download-lambda-chromium but it might be nice to integrate it directly to @astral scope. The only thing is that it's a third-party maintaining the upstream recompiled version.

The flags are mostly taken from:
https://github.com/Sparticuz/chromium/blob/dd57f035695c6773e17768176bda1910b1e39287/source/index.ts#L33-L89

@lowlighter
Copy link
Contributor Author

Seems that https://example.com/ has changed their design and tests content must be updated

@lino-levan
Copy link
Owner

This is actually super cool. Totally see the vision here and I actually would love for the astral scope to get a dedicated downloader tool both to help resolve #164 and to add support for this cut down version of chromium. Will give this PR a proper review later, going to add this to my due app so that I keep getting pinged until I do it.

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.

2 participants