{"record":{"id":"788c28a6a4b9f9eb","repo":"anomalyco/sst","slug":"there-have-been-some-minor-changes-to-the-router","errorCode":null,"errorMessage":"There have been some minor changes to the \"Router\" component that's being referenced by \"${name}\".\n\nTo update, you'll need to redeploy the stage where the Router was created. And then redeploy this stage.","messagePattern":"There have been some minor changes to the \"Router\" component that's being referenced by \"(.+?)\"\\.\n\nTo update, you'll need to redeploy the stage where the Router was created\\. And then redeploy this stage\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/router.ts","lineNumber":1437,"sourceCode":"      const r = handleLazyRoutes();\n      cdn = output(r.distribution);\n      kvStoreArn = r.kvStoreArn;\n      kvNamespace = output(r.kvNamespace);\n    }\n\n    this.cdn = cdn;\n    this.kvStoreArn = kvStoreArn;\n    this.kvNamespace = kvNamespace;\n    this.hasInlineRoutes = output(hasInlineRoutes);\n    this._protectionMode = protection;\n    registerOutputs();\n\n    function reference() {\n      const ref = args as unknown as RouterRef;\n      const cdn = Cdn.get(`${name}Cdn`, ref.distributionID, { parent: self });\n      const tags = cdn.nodes.distribution.tagsAll.apply((tags) => {\n        if (tags?.[\"sst:ref:version\"] !== _refVersion.toString()) {\n          throw new VisibleError(\n            [\n              `There have been some minor changes to the \"Router\" component that's being referenced by \"${name}\".\\n`,\n              `To update, you'll need to redeploy the stage where the Router was created. And then redeploy this stage.`,\n            ].join(\"\\n\"),\n          );\n        }\n\n        return {\n          kvStoreArn: tags?.[\"sst:ref:kv\"],\n          kvNamespace: tags?.[\"sst:ref:kv-namespace\"],\n          hasInlineRoutes: tags?.[\"sst:ref:kv\"] === undefined,\n          protection: tags?.[\"sst:ref:protection\"] ?? \"none\",\n        };\n      });\n\n      return {\n        cdn,\n        kvStoreArn: tags.kvStoreArn,","sourceCodeStart":1419,"sourceCodeEnd":1455,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/router.ts#L1419-L1455","documentation":"When a stage references a Router created in another stage via a RouterRef, SST stamps the underlying CloudFront distribution with an `sst:ref:version` tag. If the referenced distribution's version tag does not match the current expected `_refVersion`, the component fails with instructions to redeploy both stages, because the referenced Router was created with an older/incompatible component version.","triggerScenarios":"Calling `Router.ref(name, { distributionID, ... })` (via `reference`) where the fetched Cdn's `tagsAll[\"sst:ref:version\"]` differs from `_refVersion` — the referenced stage was deployed with an older SST version of the Router component.","commonSituations":"Cross-stage references (e.g. prod stage referencing a Router built in another stage) after an SST upgrade; one stage redeployed but the stage owning the Router not yet updated.","solutions":["Redeploy the stage where the Router was originally created (so its distribution gets the new ref version tag), then redeploy the referencing stage","Upgrade SST to the same version across all stages and deploy the Router-owning stage first","As a last resort, recreate the referenced Router in its own stage so the new version tag is applied"],"exampleFix":"// before\nnpx sst deploy --stage other-stage   # referencing stage only\n// after\nnpx sst deploy --stage router-stage  # owner first\nnpx sst deploy --stage other-stage   # then referrer","handlingStrategy":"retry","validationCode":"import { GetResource } from \"@pulumi/pulumi\";\n// check the ref version tag before referencing:\n// aws cmdline: aws cloudfront list-tags-for-resource --resource <distribution-arn>\n// expect tag sst:ref:version to equal your current SST Router _refVersion","typeGuard":null,"tryCatchPattern":"try {\n  const router = Router.ref(\"MyRouter\", { distributionID: id });\n} catch (e) {\n  if (String(e).includes(\"redeploy the stage where the Router was created\")) {\n    console.error(\"Redeploy owner stage first, then this stage\");\n  }\n  throw e;\n}","preventionTips":["Pin the same SST version in every stage/CI pipeline","Deploy the Router-owning stage before any referencing stage in CI order","Avoid cross-stage Router references during version upgrades until owner stage is updated"],"tags":["router","cross-stage-reference","cloudfront","versioning","sst"],"backgroundTag":"cross-stage-reference-version-mismatch","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}