You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Signing in via the built-in IdP throws a 500 on Node runtimes older than v20:
TypeError: matchedLayers.toReversed is not a function
at .../javascript-solid-server/src/idp/index.js:146 (forwardToProvider -> provider.callback())
at .../@koa/router/dist/index.js:1042
POST /idp/reg -> 500
The call is not in JSS source — it's in @koa/[email protected] (dist/index.js:1042), which oidc-provider uses internally for route matching:
Array.prototype.toReversed is ES2023 (Node 20+). On Node 18 — e.g. nodejs-mobile's embedded runtime — it's undefined, so OIDC dynamic client registration / the interaction flow 500s and sign-in bounces back.
Repro
Embed JSS with idp: true on a Node 18 runtime (here: nodejs-mobile on Android, JSS 0.0.196). Open a Solid client (pilot), point it at the pod, sign in → POST /idp/reg → 500.
Why it matters
Same class as the other oidc-provider-driven runtime gaps tracked in #522 (Intl.ListFormat, global crypto, URL.parse) — modern-Node features the IdP dependency chain assumes. oidc-provider already warns "Use Node.js v22.x LTS".
Options
Document a minimum runtime for the IdP (Node 20+, ideally 22 LTS per oidc-provider's own warning).
Ship a small polyfill for the change-array-by-copy methods when idp is enabled, so embedded/older runtimes work. (We currently polyfill toReversed / toSorted / with app-side as a workaround.)
Bump/replace the dependency if a Node-18-compatible @koa/router line exists (probably not worth it).
Not a one-line JSS source fix like #520 / #521 — filing for tracking because JSS ships and enables the IdP.
Surfaced by the Android (nodejs-mobile) work — tracked in #522. Dependency-driven (oidc-provider → @koa/router), so it belongs with the runtime-contract items rather than the source-level fixes #520 / #521.
A second instance of the same root cause turned up right after toReversed: oidc-provider also calls crypto.hash() (the one-shot helper added in Node 21.7) in ~8 files (lib/models/client.js, lib/helpers/pkce.js, certificate_thumbprint.js, validate_dpop.js, replay_detection.js, initialize_keystore.js, id_token.js, script_src_sha.js). On Node 18 this 500s the /idp/auth interaction with a generic server_error.
Notable: it's imported via import * as crypto from 'node:crypto' — an immutable namespace, so a runtime polyfill can't add hash; the call sites have to be rewritten (createHash + digest) or the runtime bumped.
Reinforces option 1 (document Node 20+/22 LTS as the IdP's minimum runtime) — the polyfill route needs a growing per-API shim list (toReversed, crypto.hash, URL.parse, Intl.ListFormat, global crypto, …), all because oidc-provider targets current LTS.
With both rewritten downstream, the OIDC flow now reaches the login interaction page (200) on nodejs-mobile's Node 18.
After reviewing the options against the current landscape, doing nothing is the right call for now:
Node 18 reached EOL April 2025 — the affected user base is naturally shrinking.
nodejs-mobile users already have a working path — per comment 2, "with both rewritten downstream, the OIDC flow now reaches the login interaction page (200) on nodejs-mobile's Node 18." The Android target has a downstream patch story.
Polyfilling is a dead end — crypto.hash lives in an immutable node:crypto namespace; even fixing toReversed wouldn't unblock the auth flow.
Bumping the dep chain isn't worth it — the issue itself flagged this.
Net: the problem is decaying without our action, and any code we add now (polyfills, conditional shims, runtime warnings) becomes maintenance debt the moment Node 18 fully fades.
Tracking the eventual engines.node bump separately as a follow-up — that's the disposition the issue itself preferred (Option 1). This issue stays open as the record of why and when Node 18 stopped being viable, in case a new user hits it before the engines bump lands.
Activity
melvincarvalho commentedon May 23, 2026
Surfaced by the Android (nodejs-mobile) work — tracked in #522. Dependency-driven (oidc-provider → @koa/router), so it belongs with the runtime-contract items rather than the source-level fixes #520 / #521.
melvincarvalho commentedon May 23, 2026
A second instance of the same root cause turned up right after
toReversed: oidc-provider also callscrypto.hash()(the one-shot helper added in Node 21.7) in ~8 files (lib/models/client.js,lib/helpers/pkce.js,certificate_thumbprint.js,validate_dpop.js,replay_detection.js,initialize_keystore.js,id_token.js,script_src_sha.js). On Node 18 this 500s the/idp/authinteraction with a genericserver_error.Notable: it's imported via
import * as crypto from 'node:crypto'— an immutable namespace, so a runtime polyfill can't addhash; the call sites have to be rewritten (createHash + digest) or the runtime bumped.Reinforces option 1 (document Node 20+/22 LTS as the IdP's minimum runtime) — the polyfill route needs a growing per-API shim list (
toReversed,crypto.hash,URL.parse,Intl.ListFormat, globalcrypto, …), all because oidc-provider targets current LTS.With both rewritten downstream, the OIDC flow now reaches the login interaction page (200) on nodejs-mobile's Node 18.
melvincarvalho commentedon Jun 9, 2026
Disposition (2026-06-08): deferring
After reviewing the options against the current landscape, doing nothing is the right call for now:
crypto.hashlives in an immutablenode:cryptonamespace; even fixingtoReversedwouldn't unblock the auth flow.Net: the problem is decaying without our action, and any code we add now (polyfills, conditional shims, runtime warnings) becomes maintenance debt the moment Node 18 fully fades.
Tracking the eventual
engines.nodebump separately as a follow-up — that's the disposition the issue itself preferred (Option 1). This issue stays open as the record of why and when Node 18 stopped being viable, in case a new user hits it before the engines bump lands.review fix (#554): explicit getSetCookie guard instead of silent zero…
fix(idp): login error survives the redirect — ride in lastSubmission — …