summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-20 00:37:48 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-20 00:37:48 +0900
commit3ec8bce7073bd922096681348fa86b6e8ff9b0d1 (patch)
tree36fef2f1fb2f5e025c49d39cfb28bb3ba6164c26
parent9232c6c29514df0cb20f27fb7157baf5ed1a255b (diff)
Debug: show raw response body to diagnose json() failure
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--app/routes/auth.register.tsx14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/routes/auth.register.tsx b/app/routes/auth.register.tsx
index 7d8fb5d..43e9c71 100644
--- a/app/routes/auth.register.tsx
+++ b/app/routes/auth.register.tsx
@@ -132,12 +132,18 @@ export default function Register() {
body: JSON.stringify({ token }),
});
setStep("1b. fetch 完了 status=" + optRes.status); await tick();
+ const rawText = await optRes.text();
+ setStep("1c. body=" + rawText.slice(0, 120)); await tick();
if (!optRes.ok) {
- const err = await optRes.json();
- throw new Error(err.error ?? "オプション取得に失敗しました");
+ throw new Error("HTTP " + optRes.status + ": " + rawText.slice(0, 200));
}
- const optJSON = await optRes.json();
- setStep("1c. JSON パース OK"); await tick();
+ let optJSON: Record<string, unknown>;
+ try {
+ optJSON = JSON.parse(rawText);
+ } catch (e) {
+ throw new Error("JSON.parse 失敗: " + String(e) + " | body: " + rawText.slice(0, 100));
+ }
+ setStep("1d. JSON パース OK"); await tick();
const userId = b64urlToBuffer(optJSON.user.id);
const challenge = b64urlToBuffer(optJSON.challenge);