Title: handleSchnorrComplete 504s when the _interaction cookie is missing · Issue #412 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
Open Graph Title: handleSchnorrComplete 504s when the _interaction cookie is missing · Issue #412 · JavaScriptSolidServer/JavaScriptSolidServer
X Title: handleSchnorrComplete 504s when the _interaction cookie is missing · Issue #412 · JavaScriptSolidServer/JavaScriptSolidServer
Description: Symptom GET /idp/interaction/
Open Graph Description: Symptom GET /idp/interaction/
X Description: Symptom GET /idp/interaction/<uid>/schnorr-complete?accountId=<id> hangs and the gateway times out with 504. JSS log shows: ``` Schnorr login completed (accountId=b0b1707f-... uid=_T_ql...
Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/412
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"handleSchnorrComplete 504s when the _interaction cookie is missing","articleBody":"## Symptom\n\n`GET /idp/interaction/\u003cuid>/schnorr-complete?accountId=\u003cid>` hangs and the gateway times out with 504. JSS log shows:\n\n\\`\\`\\`\nSchnorr login completed (accountId=b0b1707f-... uid=_T_qlTgrG3zS1...)\nPromise errored, but reply.sent = true was set\nerr: SessionNotFound: invalid_request — interaction session id cookie not found\n at #getInteraction (oidc-provider/lib/provider.js:405)\n at Provider.interactionResult (provider.js:199)\n at Provider.interactionFinished (provider.js:217)\n at handleSchnorrComplete (src/idp/interactions.js:833)\n\\`\\`\\`\n\nThe connection hangs because the handler called \\`reply.hijack()\\` before \\`provider.interactionFinished(...)\\`, so when \\`interactionFinished\\` throws, Fastify can't send the error and the socket sits open until the gateway times it out.\n\n## Reproduction\n\nAnything that breaks \\`_interaction\\` cookie continuity between the OIDC \\`/auth\\` step and \\`/schnorr-complete\\`:\n\n- Start the OIDC flow in browser A, copy-paste the interaction URL into browser B (today's repro)\n- Third-party cookie blocking on a cross-site IdP/RP boundary\n- Incognito → main session\n- The same flow after a long idle (cookie expired but interaction record still findable)\n\n## Cause\n\n\\`handleSchnorrComplete\\` (\\`src/idp/interactions.js:805\\`) does the right thing structurally — looks up the interaction by \\`uid\\`, validates the accountId — and then calls \\`provider.interactionFinished(request.raw, reply.raw, interaction.result, ...)\\`. \\`interactionFinished\\` internally re-reads the \\`_interaction\\` cookie via \\`#getInteraction\\` and explodes when it's missing, even though we already proved we have the right interaction.\n\nTwo compounding issues:\n\n1. **Unnecessary cookie dependency.** We have the interaction object in hand. The cookie check is redundant for this code path.\n2. **Hijack-then-throw silently hangs.** \\`reply.hijack()\\` is called BEFORE \\`interactionFinished\\`. If \\`interactionFinished\\` throws, Fastify's \\`Promise errored, but reply.sent = true was set\\` warning fires and nobody writes a response. Connection hangs → 504.\n\n## Fix sketches\n\nA. Move the OIDC finalize into \\`handleSchnorrLogin\\`. The login handler already saves \\`interaction.result\\` and has the \\`_interaction\\` cookie in flight (it's still the same browser, same request). After saving, it can call \\`provider.interactionFinished(request.raw, reply.raw, result, {...})\\` and return its redirect target as \\`redirectUrl\\` in the JSON. Drop \\`schnorr-complete\\` entirely. This is the cleanest fix because it removes the cookie-dependency window.\n\nB. Keep \\`schnorr-complete\\` but bypass \\`interactionFinished\\`. We have the saved \\`interaction.result\\` and can directly construct the OIDC continue URL (\\`interaction.returnTo\\`) ourselves. Redirect the browser there and oidc-provider's auth endpoint picks up the saved result without needing the cookie.\n\nC. Defensive: don't \\`reply.hijack()\\` until AFTER \\`interactionFinished\\` resolves. At minimum this turns a 504 hang into a clean 4xx so users get a real error.\n\nA or B fix the actual flow. C should land regardless.\n\n## Refs\n\n- Surfaced during live testing of #408 on solid.social\n- Handler: \\`src/idp/interactions.js:805-838\\`\n- Related #399 / #403 / #405 (the Schnorr login chain)","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-05-10T05:08:45Z","url":"https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/412"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c8319abe-84c6-40fc-e952-d826cf371668 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 956E:1702C5:298B9B1:36DD176:6B038A03 |
| html-safe-nonce | f4d69ae7ace1599978167778f862face0f703d4175b600dcff283e6070c2a2f2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTZFOjE3MDJDNToyOThCOUIxOjM2REQxNzY6NkIwMzhBMDMiLCJ2aXNpdG9yX2lkIjoiNTI0NTEzNjg3ODI2MDQyMzE3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6e04666ee0c385764c7487877645f3d2bef6f521bf8a131d89536a9fccca7586 |
| hovercard-subject-tag | issue:4414705278 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/JavaScriptSolidServer/412/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c210d286c372714d0ddf839f3822f6de96269eba8d21695e0ba166aabe78fe4f/JavaScriptSolidServer/JavaScriptSolidServer/issues/412 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c210d286c372714d0ddf839f3822f6de96269eba8d21695e0ba166aabe78fe4f/JavaScriptSolidServer/JavaScriptSolidServer/issues/412 |
| og:image:alt | Symptom GET /idp/interaction/ |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 958025407 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 958025407 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width