The "frontend-token-secret" secret is not available to the production build when it's needed #44
Labels
No labels
backend
bug
CI
dependencies
design
documentation
duplicate
enhancement
frontend
github_actions
good first issue
help wanted
invalid
javascript
question
refactoring
security
tooling
UX
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
NBIS/sda-download-ui#44
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Describe the bug
The
frontend-token-secretsecret is required when the pages are rendered, and they are rendered during the build step. In production, the build step happens before run time, which means that the container does not have the secret file available yet, as it is mounted at run time (-->fails). In development, the build happens during run time, so the secret is available (-->succeeds).This means that the code on the
developbranch currently can not be built for production.It is possible that the
SESSION_TOKEN_SECRET_PATHvariable should be passed to the build step via a build argument and then made into an environment variable in the Dockerfile, but also means the secret itself probably needs to be copied into the container (or be made available via a temporary bind mount), which seems odd. The use of the variable should be reevaluated and its implementation fixed.I have investigated this and I think I know what the problem is here.
The problem is that pages which use the session should generally note be prebuilt in this way. The prebuild step tries to use the session which does not currently exist. I have identified what I think is the solution: https://nextjs.org/docs/app/api-reference/functions/connection
I will provide a fix for this.