File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ status : done
3+ depends : [saml-login-return-path]
4+ specs :
5+ - specs/api/saml.md
6+ issues : []
7+ pr : null
8+ ---
9+
10+ # Plan: samlify ESM/CJS interop in the production build
11+
12+ ## Scope
13+
14+ The first signed-in Slack SSO attempt against the live site 500'd:
15+ ` Cannot read properties of undefined (reading 'replaceTagsByValue') ` in
16+ ` dist/saml/config.js ` . samlify is CommonJS; under Node's ESM loader,
17+ cjs-module-lexer does not detect ` SamlLib ` (re-exported through a getter),
18+ so ` import * as samlify ` leaves it undefined and only ` default `
19+ (module.exports) carries it. vitest's interop exposes it as a named export,
20+ which is why all 19 SAML tests passed while production failed.
21+
22+ In: resolve the module from whichever view carries ` SamlLib ` ; verify the
23+ compiled output under plain Node. Out: replacing samlify.
24+
25+ ## Implements
26+
27+ - [ api/saml.md] ( ../specs/api/saml.md ) — no behaviour change; the assertion
28+ pipeline works as specified once the library resolves.
29+
30+ ## Approach
31+
32+ ` apps/api/src/saml/config.ts ` : pick ` samlifyNs.default ` when it carries
33+ ` SamlLib ` , else the namespace. Verified with
34+ ` node -e "import('./dist/saml/config.js')" ` after ` npm run build ` .
35+
36+ ## Validation
37+
38+ - ` npm run type-check && npm run lint ` ; SAML suite 19/19.
39+ - Post-deploy: Slack "Test configuration" completes for a signed-in user.
40+
41+ ## Follow-ups
42+
43+ - Tracked as: a build-output smoke test (import the compiled API under plain
44+ Node in CI) would have caught this before release — worth adding to
45+ ` ci.yml ` after ` npm run build ` .
You can’t perform that action at this time.
0 commit comments