fix(deploy): set STATIC_URL for the production frontend build - #411
Merged
Conversation
The upstream merge (#313) added STATIC_URL to rsbuild.config.ts as OPTIONAL_VAR. mkDefinePluginOptsForEnv treats an unset OPTIONAL_VAR as fatal when NODE_ENV=production, so the integration frontend build died with "process.env.STATIC_URL missing in production build" and the S3 bundle was never replaced. That left Studio serving pre-merge client JS against a post-merge server. The server migrates bundles and writes CodeComponentMeta.subtreePrefetchingConfig (migration 258); the stale client's compiled model meta has no such field, so opening any existing project failed with: Unexpected fields on [CodeComponentMeta]: + subtreePrefetchingConfig getStaticUrl() falls back to getPublicUrl() (shared/urls.ts:63), so setting STATIC_URL to FRONTEND_URL reproduces pre-merge behaviour exactly and keeps static assets on our own CloudFront distribution rather than moving them.
field123
force-pushed
the
fix/frontend-deploy-static-url
branch
from
August 11, 2026 15:50
d0be1a1 to
9ec5c7c
Compare
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.
Fixes the integration outage —
Unexpected fields on [CodeComponentMeta]: + subtreePrefetchingConfigwhen opening an existing project.What happened
deploy-integrationsucceeded on00af6c2976;deploy-frontend— which runs onworkflow_runafter it — failed (run 31478165556):STATIC_URLarrived with the upstream merge (it has zero hits in the pre-mergemkDefinePluginOptsForEnv.ts) and is declaredOPTIONAL_VARatrsbuild.config.ts:248.OPTIONAL_VARis fatal whenNODE_ENV=production, so the build died before emitting anything and the S3 bundle was never replaced.Why that produced the error
The two halves of the deploy diverged:
258-add-code-component-subtree-prefetching-config, writessubtreePrefetchingConfigonto everyCodeComponentMeta.classes-metashas no such field.model-meta.ts:288-295prefixes+for a key present on the instance but absent from the meta — precisely this direction. So it's a client/server skew, not corrupt data and not a bad migration.The fix
getStaticUrl()isprocess.env.STATIC_URL || getPublicUrl()(shared/urls.ts:63), soFRONTEND_URLreproduces pre-merge behaviour exactly. Deliberately notHOST_URL— upstream #3049 (DEVOP-445) moves static/canvas content to a dedicated subdomain, and repointing where Studio fetches static assets is a behaviour change that shouldn't ride along with an incident fix. Worth doing deliberately afterwards.After merging
Dispatch
deploy-frontend.ymlwithenvironment=integration, then confirm an existing project opens. No data repair needed — the bundles are correct; only the client was behind.Follow-ups
deploy-frontendfailing leaves a silently half-deployed system: the server moves, the client doesn't, and nothing blocks or alerts. Worth making a frontend-deploy failure a hard gate.