Skip to content

@clerk/testing retries FAPI token refresh after Playwright page/context closure #10011

Open

Description

@mlegls

@clerk/testing retries a Convex-template token refresh after its Playwright page/context has closed, then logs a FAPI failure between passing tests.

Observed with @clerk/testing 2.2.36, Playwright 1.63.0, Node 24.19.0, macOS arm64. A signed-in test opens a second page with browser.newPage(), signs in using clerk.signIn({ page, signInParams: { strategy: "email_code", identifier } }), performs its authenticated interaction successfully, and closes that page in finally. If a Clerk background token refresh is still routed at that point, the handler retries four times and prints:

[Clerk Testing] FAPI request failed after 4 attempts: <redacted FAPI Convex-token URL> (Error: route.fetch: Target page, context or browser has been closed)

This occurred after two passing cases in one eight-case run; the run exited 0 with all eight cases passing. It is not an observed authentication failure or a 429. The endpoint/query are redacted because they include session/token values.

Our project already has a local patch that returns early when String(error).includes("Test ended"); it does not cover this different Playwright closure error. No other route-handler changes are applied. We have not retested a newer Clerk Testing release.

Expected: do not retry or warn for a request aborted solely because its owning page/context has closed. Keep genuine FAPI/network failures visible. Current workaround: distinguish these post-close diagnostics from the test result; no assertion or authentication bypass was added.

Activity

  1. github-actions commented on Nov 3, 2026

    @github-actions
    Contributor

    Hello 👋

    We currently close issues after 40 days of inactivity. It's been 30 days since the last update here. If we missed this issue, please reply here. Otherwise, we'll close this issue in 10 days.

    As a friendly reminder: The best way to see an issue fixed is to open a pull request. If you're not sure how to do that, please check out our contributing guide.

    Thanks for being a part of the Clerk community! 🙏

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions