Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

bug(nuxt): repeated Set-Cookie headers are overwritten by clerkMiddleware

オープン 初心者向け
#9,573 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
86/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
nuxtjs, typescript

調査の方向性

packages/nuxt/src/runtime/server/tests/clerkMiddleware.test.ts から始め、特に 116-143 行付近の再現ケースを確認し、H3 ハンドラーによって実行される clerkMiddleware の経路を調査します。認証ヘッダーをモックした状態で対象を絞ったテストを実行します。完了条件は、追加された両方の Set-Cookie ディレクティブが Nuxt のレスポンスで引き続き利用可能であることです。

索引モデルが issue の本文から書いたものです。

説明

Preliminary Checks
Reproduction

https://github.com/BalajiSriraman/javascript/blob/fix/nuxt-preserve-set-cookie-headers/packages/nuxt/src/runtime/server/__tests__/clerkMiddleware.test.ts#L116-L143

The package's existing clerkMiddleware.test.ts can reproduce this without a Clerk instance: mock authenticateRequest() with a Headers object containing two appended Set-Cookie values, run the H3 handler, then inspect response.headers.getSetCookie(). Only the last value remains.

Publishable key

Not applicable. This is a unit-level server middleware reproduction and does not make a request to Clerk.

Description

Steps to reproduce:

  1. Create a Headers instance and append two Set-Cookie values, such as an expired __clerk_handshake cookie and a refreshed __session cookie.
  2. Return those headers from the mocked authenticateRequest() result used by clerkMiddleware.
  3. Send a request through the H3 handler and inspect response.headers.getSetCookie().

Expected behavior:

Both cookie directives are present in the Nuxt response. Set-Cookie is a repeatable response header, and Clerk can return several cookie mutations from one authentication or handshake result.

Actual behavior:

Only the last cookie directive is present. clerkMiddleware iterates over the authentication headers and calls H3's setResponseHeader() for every value. That API replaces a previous value with the same name, so each Set-Cookie overwrites the preceding one.

This can leave an expired or stale Clerk handshake cookie in the browser when its deletion directive is followed by another cookie directive. Subsequent server requests can then continue entering the handshake path until that short-lived cookie expires.

Environment
System:
  OS: Linux 6.16 Pop!_OS 24.04 LTS
  CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz
Binaries:
  Node: 25.0.0
  npm: 11.6.2
  pnpm: 10.33.0
Browsers:
  Chrome: 150.0.7871.46
npmPackages:
  @clerk/nuxt: 3.0.15
  h3: 1.15.11
主要言語
TypeScript
スター
1.8k
フォーク
472
平均マージ
2日 10時間
マージ済み PR(30日)
215

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

clerk/javascript のほかの issue

clerk/javascript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。