[2.0 rc.14 / next] Direct server-function calls report handled redirects to the error hook as failures
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
調査の方向性
Start with reportDirectFailure and the HTTP dispatch response handling described in the issue, then inspect the direct-call envelope unwrapping added in #3910 and the related tests. Reproduce with the supplied script after building @solidjs/web. Done means handled thrown responses and envelopes are not reported as direct server-function failures, while ordinary errors are still reported and response identity and envelope unwrapping stay unchanged.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
A server function called directly during SSR reports a thrown redirect() or reload() response to configureServerErrors, even when the caller handles it. A thrown respond() envelope is reported too, before the caller receives its unwrapped value. With the documented Sentry.captureException hook, a handled auth redirect is still logged as an exception.
HTTP dispatch already handles Response and ResponseEnvelope before its error-reporting path. RFC 10 calls a thrown response "intentional control flow". The direct path in reportDirectFailure reports both.
Your example website or app
Reproduced in solid at 84dada77. The standalone script below uses the built workspace packages and needs no application or browser.
Steps to reproduce the bug or issue
After pnpm install --frozen-lockfile and pnpm exec turbo run build --filter=@solidjs/web, save this as repro.mjs in the repository root and run node repro.mjs:
import assert from "node:assert/strict";
import { AsyncLocalStorage } from "node:async_hooks";
import { configureServerErrors, createRequestEvent, redirect, renderToString } from "@solidjs/web";
import { createServerReference, registerServerReference } from "@solidjs/web/server-functions/server";
const storage = new AsyncLocalStorage();
globalThis[Symbol.for("solid.RequestContext")] = storage;
const errors = [];
configureServerErrors({ onError: error => void errors.push(error) });
const signal = redirect("/login");
const load = createServerReference(registerServerReference("repro/direct-redirect", () => {
throw signal;
}));
let caught;
storage.run(createRequestEvent(new Request("https://example.test/")), () =>
renderToString(() => {
try {
load();
} catch (error) {
caught = error;
}
return "";
})
);
assert.equal(caught, signal);
assert.equal(errors.length, 0, "a redirect should not reach the error hook");
console.log("Redirect preserved; error hook calls: 0");
The redirect reaches the caller unchanged, but the hook also receives it with kind: "server-function", handling: "thrown", and direct: true. The final assertion expects zero calls and receives one. The script catches the redirect inside the render. With the proposed guard, a response that reaches a boundary or the render root is reported by the renderer instead. The renderer's own handling remains unchanged.
Expected behavior
A thrown response or envelope handled by the direct caller should not reach the error hook as a server-function failure, matching HTTP dispatch. Ordinary errors should still be reported. The response's identity and the envelope's unwrapped value should stay the same.
Screenshots or videos
Not applicable; this is server-side behavior.
Platform
- macOS 27.0.1, arm64; Node.js 24.21.0.
- Solid
nextat84dada774d35ff79256e24b5e2feadea4b1dec22(workspace package version2.0.0-rc.14). No browser involved.
Additional context
The hook was introduced in #3481. #3910 added direct-call envelope unwrapping, but that happens after reportDirectFailure has already reported the envelope.
I propose applying the HTTP dispatch predicate before reportDirectFailure calls the hook. The renderer would keep its current handling of uncaught values, including errors carried by thrown envelopes. RFC 12 rejects throwing responses through boundaries, so I would leave that layer alone.
Would matching HTTP dispatch here be the intended behavior? I opened a PR with a one-line guard and tests, and I'm happy to change it if you'd rather handle this differently.
- 主要言語
- TypeScript
- スター
- 36.1k
- フォーク
- 1.1k
- 平均マージ
- 11時間 49分
- マージ済み PR(30日)
- 346
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
solidjs/solid のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 半日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 14/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
`cf complete zsh >> .zshrc` fails on vanilla zsh再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cloudflare/cf#340 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
Rename Madson cameraオープン
難易度 2/5 1時間未満 初心者へのやさしさ 75/100
StoDevX/AAO-React-Native#8785 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
-
bnv-manager-v2: accept_invite creates the Mailcow domain admin before the commit対応中かも @myOmikron が今日担当しました。 オープンbug ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100