Repository navigation
fix(dashboard): pass NEXT_PUBLIC_AFFILIATES_ENABLED into Docker build - #742
Merged
Merged
Conversation
Next.js inlines NEXT_PUBLIC_* at next build, and Railway only forwards service variables into Dockerfile builds when declared as ARG. Without this, the client-side ?ref= capture can never see the flag. Unset ARG keeps the flag off (unchanged behavior). Document that changing the flag requires a dashboard rebuild.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base branch:
develop.Summary
Next.js inlines
NEXT_PUBLIC_*into the bundle atnext build. Railway only forwards service variables into a Dockerfile build when they are declared asARG, and the rootDockerfiledeclared none, so no dashboardNEXT_PUBLIC_*value ever reached the build (verified on prod bundles:env.NEXT_PUBLIC_*references are left un-inlined). For affiliates this means the client-sideReferralCapture(/?ref=<code>) could never activate even after settingNEXT_PUBLIC_AFFILIATES_ENABLED=true.Dockerfile(build stage, beforepnpm --filter dashboard build):ARG NEXT_PUBLIC_AFFILIATES_ENABLED+ENV NEXT_PUBLIC_AFFILIATES_ENABLED=$NEXT_PUBLIC_AFFILIATES_ENABLED.NEXT_PUBLIC_*(Sentry / telemetry) intentionally not added — that would change prod behavior and is a separate decision.docs/AFFILIATES.md: the dashboard flag is build-time; changing it requires a dashboard rebuild, not a cached-image redeploy.CHANGELOG.md[Unreleased]entry.Unset behavior: the variable is not set on the Railway dashboard service today, so the ARG is empty →
""is inlined →"" !== "true"→ flag OFF, same as today. The ENV lives only in the build stage (runner stage startsFROM base).How to test
hadolint Dockerfile→ only the pre-existing DL3008 warning (identical todevelop).build.NEXT_PUBLIC_AFFILIATES_ENABLED=trueon the dashboard service (Railway rebuilds) →/?ref=<code>writes sessionStoragett_affiliate_ref.Code review (Bugbot)
Checklist
[Unreleased]Security / privacy
N/A — a boolean public flag only; no secrets passed as build args.