{"record":{"id":"bde45656d1e7b692","repo":"anomalyco/sst","slug":"failed-to-get-auth-token-for-redis-name","errorCode":null,"errorMessage":"Failed to get auth token for Redis ${name}.","messagePattern":"Failed to get auth token for Redis (.+?)\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/redis-v1.ts","lineNumber":581,"sourceCode":"    const cluster = elasticache.ReplicationGroup.get(\n      `${name}Cluster`,\n      clusterID,\n      undefined,\n      opts,\n    );\n    const secret = cluster.tagsAll.apply((tags) =>\n      tags?.[\"sst:auth-token-ref\"]\n        ? secretsmanager.getSecretVersionOutput(\n            {\n              secretId: tags[\"sst:auth-token-ref\"],\n            },\n            opts,\n          )\n        : output(undefined),\n    );\n    const authToken = secret.apply((v) => {\n      if (!v)\n        throw new VisibleError(`Failed to get auth token for Redis ${name}.`);\n      return JSON.parse(v.secretString).authToken as string;\n    });\n\n    return new Redis(name, {\n      ref: true,\n      cluster,\n      authToken,\n    } as unknown as RedisArgs);\n  }\n}\n\nconst __pulumiType = \"sst:aws:Redis\";\n// @ts-expect-error\nRedis.__pulumiType = __pulumiType;\n","sourceCodeStart":563,"sourceCodeEnd":596,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/redis-v1.ts#L563-L596","documentation":"When Redis v1 components are referenced via ref, SST re-creates the cluster reference by looking up the stored auth token from a secret. If the secret exists but its value is empty or unresolvable, the apply throws this VisibleError.","triggerScenarios":"Calling Redis.get(name, ...) for an existing cluster where the referenced secret's secretString is empty or fails to resolve (secret deleted/rotated).","commonSituations":"Secret removed from state or region mismatch; manual secret deletion; referencing a cluster in a different app/stage where the secret doesn't exist.","solutions":["Verify the auth token secret exists in Secrets Manager in the same region/stage","Redeploy the original Redis component so the secret is recreated","If rotation emptied the value, restore it with the cluster's authToken"],"exampleFix":"// before (referencing a cluster whose secret was deleted)\nconst redis = sst.aws.Redis.get(\"Redis\", \"my-cluster\");\n// after: redeploy the owning component first so the secret is recreated\n// sst deploy --stage <stage> (in the app that owns the cluster), then get() again","handlingStrategy":"validation","validationCode":"// before Redis.get, verify the auth token secret exists\nconst secretName = `/<app>/<stage>/Redis/<name>/authToken`;\nawait aws.secretsmanager.getSecretValue({ SecretId: secretName }); // throws if missing","typeGuard":null,"tryCatchPattern":"try {\n  const redis = sst.aws.Redis.get(\"Redis\", \"my-cluster\");\n} catch (e) {\n  if (String(e).includes(\"auth token\")) console.error(\"Recreate the auth token secret or redeploy the owning stack\");\n  throw e;\n}","preventionTips":["Never delete the auth-token secret manually","Redeploy the owning stack after secret changes","Check region/stage match before using Redis.get"],"tags":["redis","elasticache","secret","auth-token"],"backgroundTag":"missing-secret","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}