Skip to content

Conversation

@Kylejeong2
Copy link
Member

why

there was an issue with the alex ai endpoint deploying to vercel, where while using stagehand v3 the scripts would correctly deploy and build, but we weren't able to use them due to some bug where ws (websocket) library would need bufferutil library to run any stagehand code properly.

what changed

added bufferutil library as an optional dep: https://www.npmjs.com/package/bufferutil

test plan

ci

@changeset-bot
Copy link

changeset-bot bot commented Nov 18, 2025

⚠️ No Changeset found

Latest commit: 4cb6763

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 18, 2025

Greptile Summary

  • Added bufferutil@^4.0.9 as an optional dependency to resolve WebSocket performance issues when deploying to Vercel
  • The bufferutil package is a recommended optional peer dependency of the ws library used for CDP WebSocket connections in lib/v3/understudy/cdp.ts

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • Adding bufferutil as an optional dependency is the correct solution for the reported WebSocket performance issue. The package is a well-established, recommended peer dependency of the ws library. Placing it in optionalDependencies is the standard practice, allowing installations to succeed even if native compilation fails on some platforms.
  • No files require special attention.

Important Files Changed

Filename Overview
packages/core/package.json Added bufferutil as optional dependency to improve WebSocket performance with the ws library.

Sequence Diagram

sequenceDiagram
    participant App as "Application"
    participant Stagehand as "@browserbasehq/stagehand"
    participant WS as "ws Library"
    participant Bufferutil as "bufferutil"
    App->>Stagehand: "Initialize with WebSocket"
    Stagehand->>WS: "Create WebSocket connection"
    WS->>Bufferutil: "Use for performance optimization"
    Bufferutil-->>WS: "Optimized buffer operations"
    WS-->>Stagehand: "WebSocket ready"
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format

@Kylejeong2 Kylejeong2 force-pushed the kylejeong/stg-977-fixing-vercel-deployment-issue-with-bufferutil-websocket branch from 9eec69f to 4cb6763 Compare November 19, 2025 21:29
@Kylejeong2 Kylejeong2 merged commit 8ff7d27 into main Nov 19, 2025
15 checks passed
monadoid pushed a commit that referenced this pull request Nov 20, 2025
there was an issue with the alex ai endpoint deploying to vercel, where
while using stagehand v3 the scripts would correctly deploy and build,
but we weren't able to use them due to some bug where ws (websocket)
library would need bufferutil library to run any stagehand code
properly.

added bufferutil library as an optional dep:
https://www.npmjs.com/package/bufferutil

ci
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.

3 participants