Skip to content

Browser Rendering local mode#9796

Merged
penalosa merged 41 commits intomainfrom
sbadoiu/testlocalbrowser
Jul 3, 2025
Merged

Browser Rendering local mode#9796
penalosa merged 41 commits intomainfrom
sbadoiu/testlocalbrowser

Conversation

@simonabadoiu
Copy link
Contributor

@simonabadoiu simonabadoiu commented Jun 30, 2025

Fixes BRAPI-43

Add local mode support for Browser Rendering. It support puppeteer and messages < 1MB.


  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: it's only a minor change

@simonabadoiu simonabadoiu requested a review from a team as a code owner June 30, 2025 13:25
@changeset-bot
Copy link

changeset-bot bot commented Jun 30, 2025

🦋 Changeset detected

Latest commit: f205694

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
miniflare Minor
wrangler Minor
@cloudflare/pages-shared Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 30, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@9796

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@9796

miniflare

npm i https://pkg.pr.new/miniflare@9796

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@9796

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@9796

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@9796

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@9796

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@9796

wrangler

npm i https://pkg.pr.new/wrangler@9796

commit: f205694

@simonabadoiu simonabadoiu changed the title Sbadoiu/testlocalbrowser test local browser Jun 30, 2025
@simonabadoiu simonabadoiu force-pushed the sbadoiu/testlocalbrowser branch from 24a10c6 to 89222bc Compare June 30, 2025 17:35
@workers-devprod workers-devprod added the e2e Run wrangler + vite-plugin e2e tests on a PR label Jun 30, 2025
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jul 1, 2025
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only looked at the first few files. Will review properly in an hour or so.

simonabadoiu and others added 5 commits July 1, 2025 17:05
Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com>
Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com>
Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com>
Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com>
Co-authored-by: Pete Bacon Darwin <pete@bacondarwin.com>
this.#log.logWithLevel(logLevel, message);
response = new Response(null, { status: 204 });
} else if (url.pathname === "/browser/launch") {
// Version should be kept in sync with the supported version at https://github.com/cloudflare/puppeteer?tab=readme-ov-file#workers-version-of-puppeteer-core
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a similar comment to the puppeteer codebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum not sure where to add it, I'll ask the maintainers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still tryong to find out where is the best place to add it, can we merge in the meantime pls?

this.#log.warn.bind(this.#log)
);

// @ts-expect-error Puppeteer is dynamically installed, and so doesn't have types available
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can add puppeteer as a dev-dependency and then grab the type of the import, without impacting the distributable size:

type Puppeteer = typeof import('puppeteer')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the types clash a bit if I do this? @penalosa is this why we didn't do it? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with this one. @penalosa @petebacondarwin we can move the discussion in a small wiki if you don't mind merging it this way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't even try doing that, to be honest—maybe it'll work? What type clashes were you seeing?

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes happy to merge this, after we run the release today. Thank you for a neat PR.

@penalosa penalosa enabled auto-merge July 3, 2025 16:49
@penalosa penalosa added this pull request to the merge queue Jul 3, 2025
Merged via the queue into main with commit ba69586 Jul 3, 2025
36 of 38 checks passed
@penalosa penalosa deleted the sbadoiu/testlocalbrowser branch July 3, 2025 23:06
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jul 3, 2025
@workers-devprod workers-devprod mentioned this pull request Jul 3, 2025
@cloudkite
Copy link

Doesnt seem to work when using the vite plugin, is this only for wrangler dev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e Run wrangler + vite-plugin e2e tests on a PR

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants