{"record":{"id":"eeaf2d2bde42a46a","repo":"anomalyco/sst","slug":"it-does-not-look-like-sst-links-are-active-if-thi","errorCode":null,"errorMessage":"It does not look like SST links are active. If this is in local development and you are not starting this process through the multiplexer, wrap your command with `sst dev -- <command>`","messagePattern":"It does not look like SST links are active\\. If this is in local development and you are not starting this process through the multiplexer, wrap your command with `sst dev -- <command>`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdk/js/src/resource/shared.ts","lineNumber":58,"sourceCode":"export function createResource<T extends Resource>(load: () => void) {\n  let loaded = false;\n  const loadData = () => {\n    if (loaded) return;\n    load();\n    loaded = true;\n  };\n\n  return new Proxy(raw, {\n    get(_target, prop: string | symbol) {\n      loadData();\n      if (prop in raw) {\n        return raw[prop as string];\n      }\n      if (typeof prop !== \"string\") {\n        return undefined;\n      }\n      if (!environment.SST_RESOURCE_App && !raw.App) {\n        throw new Error(\n          \"It does not look like SST links are active. If this is in local development and you are not starting this process through the multiplexer, wrap your command with `sst dev -- <command>`\",\n        );\n      }\n      let msg = `\"${prop}\" is not linked in your sst.config.ts`;\n      if (environment.AWS_LAMBDA_FUNCTION_NAME) {\n        msg += ` to ${environment.AWS_LAMBDA_FUNCTION_NAME}`;\n      }\n      throw new Error(msg);\n    },\n    has(_target, prop: string | symbol) {\n      loadData();\n      return prop in raw;\n    },\n    ownKeys() {\n      loadData();\n      return Reflect.ownKeys(raw);\n    },\n    getOwnPropertyDescriptor(_target, prop: string | symbol) {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/sdk/js/src/resource/shared.ts#L40-L76","documentation":"SST's Resource proxy throws this when a property is accessed but neither the SST_RESOURCE_App environment variable nor raw.App is present — meaning the process was not started through `sst dev`'s multiplexer (or deployed by SST), so the link runtime data was never loaded. It exists to explain why links appear 'dead' in local development.","triggerScenarios":"Accessing any property on Resource (e.g. Resource.MyBucket.bucketName) in a locally run process where environment.SST_RESOURCE_App and raw.App are both unset — i.e. the process was started directly (node/bun script) instead of via `sst dev -- <command>`.","commonSituations":"Running `npm run dev` or `bun run index.ts` directly instead of through the SST multiplexer; running tests that import Resource outside `sst dev`; an app name mismatch causing SST_RESOURCE_App to be missing; stale .env not produced by SST.","solutions":["Start the process through the multiplexer: `sst dev -- <your command>` (e.g. `sst dev -- npm run dev`).","If this is deployed code, ensure the function was deployed by SST so SST_RESOURCE_App is injected.","For tests or non-SST scripts, avoid importing Resource at module scope or mock the resource environment variables.","Confirm the process actually runs inside the multiplexer-spawned environment (check process.env.SST_RESOURCE_App) rather than a separately spawned child."],"exampleFix":"// before (package.json)\n\"scripts\": { \"dev\": \"bun run index.ts\" }\n// run: npm run dev\n\n// after\n\"scripts\": { \"dev\": \"sst dev -- bun run index.ts\" }\n// run: npm run dev (or directly: sst dev -- bun run index.ts)","handlingStrategy":"validation","validationCode":"// before touching Resource, check the link runtime is active\nif (!process.env.SST_RESOURCE_App) {\n  console.error(\"Start with: sst dev -- <your command>\");\n  process.exit(1);\n}","typeGuard":"function isSstDevActive(): boolean {\n  return Boolean(process.env.SST_RESOURCE_App);\n}","tryCatchPattern":"try {\n  const bucket = Resource.MyBucket.name;\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"SST links are active\")) {\n    throw new Error(\"Run via: sst dev -- <command>\");\n  }\n  throw e;\n}","preventionTips":["Always launch local processes with `sst dev -- <command>`, never directly.","Add a startup assertion on SST_RESOURCE_App in dev-only code paths.","Avoid importing Resource in test runners that bypass the multiplexer.","Document the `sst dev --` wrapper in your project's README scripts."],"tags":["local-development","environment","links","sst-dev"],"backgroundTag":"missing-env-var","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}