Repository navigation
website: fix ColorModeProvider crash on API reference pages - #24261
Conversation
Every generated page on api.goauthentik.io renders a Docusaurus error overlay instead of content: "Hook k is called outside the <ColorModeProvider>". The docusaurus group bump in #24000 moved eleven packages from 3.10.1 to 3.10.2 but left @docusaurus/theme-common and @docusaurus/types behind at ^3.10.1. That range still admits the older resolution, so pnpm kept 3.10.1 in the lockfile and website/api ended up with a second copy of theme-common nested under itself and under docusaurus-theme-openapi-docs. theme-common is where ColorModeContext is defined. theme-classic renders its provider from the hoisted 3.10.2 copy while the OpenAPI theme's components call useColorMode from the 3.10.1 copy, so the hook reads a context object that was never populated and throws. The SSR build succeeds either way, which is why this only ever showed up in a browser. Aligning the four stale specifiers and the matching override collapses the tree back to a single theme-common. Verified against a production build: the four reference pages that previously threw now load clean and the hand-authored landing page is unaffected. docs.goauthentik.io and integrations.goauthentik.io never carried a second copy and were never affected. Closes #24026 Co-Authored-By: Agent (authentik-i24026-aligned-educational-pine) <[email protected]>
Two things kept the duplicate resolution reachable after the version alignment. @goauthentik/docusaurus-theme imports useColorMode, ColorMode and ThemeClassNames from @docusaurus/theme-common across five files but never declared the dependency. It resolved anyway because the website workspace uses pnpm's hoisted linker, so the shared theme package was picking up whatever copy happened to land at the root. Declaring it makes the resolution the theme actually relies on an explicit one. The override was keyed on @goauthentik/docusaurus-config, which website consumes through link:../../packages/docusaurus-config. That path leaves the website workspace, and the version it restated there had to be kept in step with website's own manifests by hand. Rekeying it unscoped drops the second copy of the version and covers every member and transitive peer rather than one linked package. Worth recording for whoever picks up the Dependabot side: peer ranges in packages/docusaurus-config stay at ^3.10.1 deliberately. They are a compatibility floor, they are only consumed by JSDoc @import types, and dependabot-core#1242 has been open since 2019, so Dependabot would never bump them regardless. Co-Authored-By: Agent (authentik-i24026-aligned-educational-pine) <[email protected]>
The Docusaurus packages ship as one lockstep release, and eleven of them are declared across api, docs, integrations and docusaurus-theme, several in three or four manifests at once. Nothing tied those declarations together, so a group bump only had to miss one to leave two versions of a package resolvable in the same tree. #24026 is what that looks like when the package owns a React context. Each version now lives once, in the catalog, and every member references it as catalog:. Dependabot has supported catalog entries since the February 2025 GA, so bumps keep arriving as before and land on all four manifests together rather than on whichever subset the group happened to match. The theme-common override reads catalog: too, which is why its importer entries record ^3.10.2 instead of catalog: — the override resolves first and pnpm writes the specifier it actually applied. The version is still stated once. Verified with pnpm install --frozen-lockfile from a cleared node_modules, which is the check that would catch a catalog and lockfile that had drifted apart. Co-Authored-By: Agent (authentik-i24026-aligned-educational-pine) <[email protected]>
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24261 +/- ##
==========================================
- Coverage 93.50% 93.47% -0.03%
==========================================
Files 1062 1062
Lines 63848 63848
Branches 424 424
==========================================
- Hits 59698 59679 -19
- Misses 4150 4169 +19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-1a1db66921956dbc07a484ab1bcadc1751a1becd
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-1a1db66921956dbc07a484ab1bcadc1751a1becdAfterwards, run the upgrade commands from the latest release notes. |
* main: (152 commits) web/bug: harmonize and make routine the display of schedules, part 2: Description lists (#23856) web: exclude dependabot-materialized link deps from workspace glob (#24297) core: fix object attributes not setting allow_blank (#24298) web: add build start/end log to build script (#24296) root: fix CODEOWNERS paths (#24259) core: object attributes - minor fixes (#24292) core: bump thiserror from 2.0.18 to 2.0.19 (#24281) core: bump serde from 1.0.228 to 1.0.229 (#24282) website/docs: update release notes for 2026.5.6 (#24293) ci: bump actions/setup-python from 6.3.0 to 7.0.0 in /.github/actions/setup (#24286) core, web: update translations (#24276) core: bump github.com/getsentry/sentry-go from 0.47.0 to 0.48.0 (#24277) core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /lifecycle/container (#24278) core: bump msgraph-sdk from 1.58.0 to 1.59.2 (#24279) core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /website (#24280) core: bump serde_repr from 0.1.20 to 0.1.21 (#24283) core: bump futures from 0.3.32 to 0.3.33 (#24284) website: fix ColorModeProvider crash on API reference pages (#24261) website/docs: add conn_options deprecation to 2026.5 release notes (#23882) website/integrations: Zammad: cleanup (#23621) ...
* main: (154 commits) web/bug: harmonize and make routine the display of tasks (part 6: sch… (#23859) web/maint: upgrade ak-toggle-group (#24038) web/bug: harmonize and make routine the display of schedules, part 2: Description lists (#23856) web: exclude dependabot-materialized link deps from workspace glob (#24297) core: fix object attributes not setting allow_blank (#24298) web: add build start/end log to build script (#24296) root: fix CODEOWNERS paths (#24259) core: object attributes - minor fixes (#24292) core: bump thiserror from 2.0.18 to 2.0.19 (#24281) core: bump serde from 1.0.228 to 1.0.229 (#24282) website/docs: update release notes for 2026.5.6 (#24293) ci: bump actions/setup-python from 6.3.0 to 7.0.0 in /.github/actions/setup (#24286) core, web: update translations (#24276) core: bump github.com/getsentry/sentry-go from 0.47.0 to 0.48.0 (#24277) core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /lifecycle/container (#24278) core: bump msgraph-sdk from 1.58.0 to 1.59.2 (#24279) core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /website (#24280) core: bump serde_repr from 0.1.20 to 0.1.21 (#24283) core: bump futures from 0.3.32 to 0.3.33 (#24284) website: fix ColorModeProvider crash on API reference pages (#24261) ...
* main: (99 commits) web/bug: harmonize and make routine the display of tasks (part 6: sch… (#23859) web/maint: upgrade ak-toggle-group (#24038) web/bug: harmonize and make routine the display of schedules, part 2: Description lists (#23856) web: exclude dependabot-materialized link deps from workspace glob (#24297) core: fix object attributes not setting allow_blank (#24298) web: add build start/end log to build script (#24296) root: fix CODEOWNERS paths (#24259) core: object attributes - minor fixes (#24292) core: bump thiserror from 2.0.18 to 2.0.19 (#24281) core: bump serde from 1.0.228 to 1.0.229 (#24282) website/docs: update release notes for 2026.5.6 (#24293) ci: bump actions/setup-python from 6.3.0 to 7.0.0 in /.github/actions/setup (#24286) core, web: update translations (#24276) core: bump github.com/getsentry/sentry-go from 0.47.0 to 0.48.0 (#24277) core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /lifecycle/container (#24278) core: bump msgraph-sdk from 1.58.0 to 1.59.2 (#24279) core: bump pnpm/pnpm from 11.14.0 to 11.15.0 in /website (#24280) core: bump serde_repr from 0.1.20 to 0.1.21 (#24283) core: bump futures from 0.3.32 to 0.3.33 (#24284) website: fix ColorModeProvider crash on API reference pages (#24261) ...
What broke
Every generated page on api.goauthentik.io renders a Docusaurus error overlay instead of content:
The site has 1139 generated reference pages and the fault is in a component all of them share, so the whole reference is down, and has been since 2026-07-14. Hand-authored pages on the same site are fine, and docs.goauthentik.io and integrations.goauthentik.io were never affected.
Why
@docusaurus/theme-commonis whereColorModeContextlives. Two copies of it were resolvable in the same tree, sotheme-classicrendered its provider into one context object while the OpenAPI theme's components read a different one. The hook found nothing and threw.The second copy arrived with #24000. That group bump moved eleven packages from 3.10.1 to 3.10.2 and left
@docusaurus/theme-commonand@docusaurus/typesat^3.10.1. The old range still admits the old resolution, so pnpm kept 3.10.1 in the lockfile:website/node_modules/@docusaurus/theme-commonwebsite/node_modules/@docusaurus/theme-classicwebsite/api/node_modules/@docusaurus/theme-commonwebsite/node_modules/docusaurus-theme-openapi-docs/node_modules/@docusaurus/theme-commonThe SSR build succeeds either way, which is why CI stayed green and the break only showed up in a browser.
The commits
Three, separable on purpose. The first fixes the outage on its own if you would rather not take the other two.
1.
website: fix ColorModeProvider crash on API reference pages— aligns the four stale specifiers and the matching override, and regenerates the lockfile. Onetheme-commonagain.2.
website: guard theme-common against a second copy—@goauthentik/docusaurus-themeimportsuseColorMode,ColorModeandThemeClassNamesfromtheme-commonacross five files without declaring it, surviving on the hoisted linker. Now declared. The override was also keyed on@goauthentik/docusaurus-config, which website reaches throughlink:../../packages/docusaurus-config. That path sits outside the workspace, so its version had to be hand-synced with website's own manifests. Rekeyed unscoped.3.
website: move the Docusaurus versions into the pnpm catalog— eleven@docusaurus/*packages, several declared in three or four manifests, now stated once and referenced ascatalog:. A group bump lands everywhere or nowhere.Verification
Reproduced first, on a production build of the pre-fix tree, then confirmed against a production build of the fix. Four reference pages sampled, headless Chromium, console captured:
/reference/core-users-set-password-hash-create//reference/core-groups-create//reference/admin-apps-list//reference/flows-instances-list//(hand-authored)The reproduction reports
Hook k, matching the issue exactly.Also run: production builds of all three sites pass;
pnpm install --frozen-lockfilefrom a clearednode_modulespasses;make lint-catalogspasses; the live sites confirm which ones were affected, with api.goauthentik.io throwing and docs and integrations clean.Two things for maintainers
pnpm dedupe --checkfails on this branch, but it also fails onmainand with a longer list. Before:esprima,gray-matter,js-yaml,shell-quote,sprintf-js. After:@types/hastandshell-quote. Pre-existing, and smaller now.website/docsfailscheck-typeswith three errors aboutConfigresolving from bothwebsite/node_modules/@docusaurus/typesand a 3.10.1 copy underpackages/docusaurus-config. Also pre-existing and reproducible onmain, so it is left alone here, but it is the same split-resolution shape across the root and website workspaces and probably wants its own fix.Peer ranges in
packages/docusaurus-configstay at^3.10.1deliberately. They are a compatibility floor, only consumed by JSDoc@importtypes, and dependabot/dependabot-core#1242 has been open since 2019, so Dependabot would not bump them either way.Closes #24026
Disclosure
Triaged and authored end-to-end by an AI agent running in a sandboxed container. A human reviewed the diff and the reasoning before submission.