setupClerkTestingToken repeats invitation acceptance requests when a 303 redirects to HTML

未關閉
#10,996 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@wobsoriano 已經在處理了。

開始於 2026年11月24日。

  • #10999 來自 @wobsoriano —— 未關閉

評估

難度
4/5
預估耗時
3-5 天
新手友好度
40/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
testing-qa, typescript
領域
testing

研究方向

Start with the reproduction repository at the linked commit: run node reproduce.mjs and then node reproduce.mjs --single-use, and note the request logs from both servers. The issue points at the setupClerkTestingToken route handler in the testing package, where route.fetch() follows the 303 and parses the HTML destination as JSON, then falls back to route.continue(). Done means one browser navigation produces one acceptance request, and the sign-up page loads in both fixtures.

由索引模型根據 Issue 內容生成。

描述

Preliminary Checks

  • Reviewed Clerk’s Playwright testing documentation.
  • Searched existing issues for this redirect and retry behavior.
  • I have not already contacted Clerk support by email or Discord about this problem.
  • This is a reproducible bug in the Clerk JavaScript testing package.

Reproduction

https://github.com/neodude/clerk-playwright-invitation-redirect-repro/tree/a786564d7a25ef2c117e18eb363775bd8c9ccff1

Publishable key

No Clerk instance or publishable key is used by this reproduction. Both HTTPS origins run on loopback.

Description

One browser navigation to an invitation acceptance URL sends multiple requests when setupClerkTestingToken is enabled. In the single-use fixture, the first request consumes the ticket and the browser ends up displaying the response to the second attempt.

Steps to reproduce

  1. Follow the reproduction README to install the pinned dependencies and generate the local TLS certificate.
  2. Run node reproduce.mjs. The ticket endpoint responds with a 303 to an HTML page on the second origin every time.
  3. Run node reproduce.mjs --single-use. The endpoint responds with a 303 once, then returns 410. Each command exercises a fresh browser context with and without the helper and logs requests to both servers.

Expected behavior

One navigation makes one acceptance request. The browser follows the 303 and loads the sign-up page.

Actual behavior

Fixture Without the helper With the helper
Endpoint returns 303 every time 1 acceptance request. Sign-up page loads. 5 acceptance requests. Sign-up page eventually loads.
Endpoint returns 303 once, then 410 1 acceptance request. Sign-up page loads. 2 acceptance requests. Browser stays at the ticket URL and displays the 410 response.

The handler follows the 303 inside route.fetch() and tries to parse the destination HTML as JSON. In the repeatable case the parsing error triggers four fetch attempts, followed by a fifth request through route.continue().

I’m happy to submit a fix and a regression test if you’d like the browser to handle these redirects directly.

Environment

System:
  OS: macOS 27.2.1
  CPU: (18) arm64 Apple M5 Max
  Memory: 4.34 GB / 128.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 26.13.1 - /opt/homebrew/bin/node
  npm: 11.20.0 - /opt/homebrew/bin/npm
  pnpm: 12.5.1 - ~/Library/pnpm/bin/pnpm
  Deno: 2.9.8 - /opt/homebrew/bin/deno
  Watchman: 2026.11.23.00 - /opt/homebrew/bin/watchman
Browsers:
  Chrome: 158.0.8127.37
  Safari: 27.2
npmPackages:
  @clerk/testing: 2.3.7 => 2.3.7
  @playwright/test: 1.65.1 => 1.65.1
主要語言
TypeScript
星號
1.8k
分支
493
平均合併
1 天 8 小時
30 天內合併 PR
359

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

clerk/javascript 的其他 Issue

查看 clerk/javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。