Skip to content

Can Stagehand work on a Cloudflare worker + Durable object setup? #564

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

Open
Suman085 opened this issue Mar 6, 2025 · 1 comment
Open

Comments

@Suman085
Copy link

Suman085 commented Mar 6, 2025

We're considering using Stagehand in a Cloudflare Worker + Durable Object (DO) setup. The Agent, built with agent-sdk, manages WebSocket connections, session state, and interacts with Browserbase to automate browser sessions.

Questions

  • Is Stagehand compatible with Cloudflare Worker + Durable Object environments?
  • Any best practices or limitations we should consider?

Currently, I am getting this error which I think occurs because of trying to load a native .node module, which is not supported in Cloudflare Workers.
Image

@jpudysz
Copy link

jpudysz commented Mar 29, 2025

Cloudflare has its own fork of Playwright: https://github.com./cloudflare/playwright, which can be spun up inside a Worker. They also provide their own browser automation solution: https://developers.cloudflare.com/browser-rendering/

I tried running Stagehand on a Cloudflare Worker a few months ago, but it wasn’t possible because Workers are not fully compatible with Node.js and therefore lack the fs module. However, this may change soon: cloudflare/workerd#3796.

So, long story short, as of now, you either use their solution or host it elsewhere.

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

No branches or pull requests

2 participants