fix(portal-bff): set REDIS_URL + SESSION_* in auth.module.spec so ci:check passes on a clean runner #116
Reference in New Issue
Block a user
Delete Branch "fix/portal-bff/auth-module-spec-env"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
CI red on
mainafter #115. Failure was masked locally becausenx testauto-loadsapps/portal-bff/.env— the CI runner has no such file, soprocess.env.REDIS_URLis genuinely unset there and the test sees the real failure path.Root cause: #115 made
AuthModuleimportSessionModulesoAuthControllercould injectUserSessionIndexService.SessionModulepulls inRedisModule, whose factory callsassertRedisConfig()and refuses to compile withoutREDIS_URL. The existingauth.module.spec.tsonly set theENTRA_*env vars — so as soon as the spec'scompile()walks the new import graph,assertRedisConfigthrows.Fix is one file: add
REDIS_URL,SESSION_SECRET,SESSION_ENCRYPTION_KEYto the spec'sVALIDenv block and dispose theioredisclient inafterEach(the spec now compiles a full SessionModule, which opens a connection at module init). Same pattern assession.module.spec.ts.Verification
The reason the bug didn't surface locally was Nx's
.envloading. To repro the CI condition locally:Before this PR (on main):
auth.module.spec.tsfails withREDIS_URL is not setatassertRedisConfig. After: 123/123 pass under that same clean env.Test plan
nx test portal-bffwith all BFF env varsunset→ 123/123 pass (the CI condition).nx lint portal-bff→ clean.nx build portal-bff→ clean.ci:checkgreen.