Skip to content

Browserstack node sdk is failing now with error Cannot find command to respond: 5 #86

Description

@rakhee-puria

Title
Cannot find command to respond: N on real mobile devices with @playwright/test >= 1.60

Environment
browserstack-node-sdk: 1.59.0
@playwright/test failing: 1.60.0, 1.60.1, 1.61.0, 1.61.1
@playwright/test working: 1.59.1
Node.js 20/22, macOS 14, ESM project
Runner: npx browserstack-node-sdk playwright test ...
Affected
Real-mobile sessions only. Reproduced on Samsung Galaxy S25 Ultra, Google Pixel 10, and iPhone 14 Pro (realMobile: true). Desktop Windows/OS X sessions are not affected.

Steps to reproduce
npm i -D browserstack-node-sdk@1.59.0 @playwright/test@1.61.1
Minimal spec:
browserstack.yml targeting Samsung Galaxy S25 Ultra, realMobile: true.
Run: npx browserstack-node-sdk playwright test smoke.spec.ts
Actual
Shortly after the first action (or at teardown):

Followed by page.waitForTimeout: Target page, context or browser has been closed on every subsequent step. Session shows the URL loaded on the device but the run ends with UnhandledError.

Expected
Same behaviour as @playwright/test@1.59.1 — session completes normally.

Suspected cause
The SDK monkey-patches Playwright's internal Connection class (sessionDetails.js, method _0x51c14e). Playwright 1.60 refactored how in-flight command callbacks are tracked in playwright-core/src/client/connection.ts, so responses arrive for IDs the patch has already released. Desktop uses a different transport, hence real-mobile-only.

Workaround
Pin @playwright/test to exact 1.59.1.

Ask
Document the supported @playwright/test version range for real-device sessions.
Ship an SDK update that patches Playwright 1.60/1.61's refactored Connection.
Consider replacing the monkey-patch with a public Playwright extension point so future refactors don't break real devices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions