{"record":{"id":"b575750eed878ca2","repo":"anomalyco/sst","slug":"no-aws-credentials-found","errorCode":null,"errorMessage":"No AWS credentials found","messagePattern":"No AWS credentials found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdk/js/src/aws/client.ts","lineNumber":71,"sourceCode":"      sessionToken: process.env.AWS_SESSION_TOKEN,\n      region: process.env.AWS_REGION,\n    });\n  }\n\n  if (process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) {\n    const credentials = await getCredentials(\n      \"http://169.254.170.2\" +\n        process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,\n    );\n    return new AwsClient({\n      accessKeyId: credentials.AccessKeyId,\n      secretAccessKey: credentials.SecretAccessKey,\n      sessionToken: credentials.Token,\n      region: process.env.AWS_REGION,\n    });\n  }\n\n  throw new Error(\"No AWS credentials found\");\n}\n\nexport async function awsFetch(\n  service: string,\n  path: string,\n  init: Omit<AwsFetchOptions, \"aws\">,\n  options?: { aws?: AwsOptions },\n) {\n  const c = await client(options?.aws);\n  const region = options?.aws?.region ?? c.region;\n  return c.fetch(`https://${service}.${region}.amazonaws.com${path}`, {\n    ...init,\n    aws: options?.aws,\n  });\n}\n","sourceCodeStart":53,"sourceCodeEnd":87,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/sdk/js/src/aws/client.ts#L53-L87","documentation":"`client()` builds an aws4fetch AwsClient for signing AWS requests. It resolves credentials in order: explicit `aws` options, then AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY env vars, then the ECS container credentials endpoint (AWS_CONTAINER_CREDENTIALS_RELATIVE_URI). If none are present, it throws \"No AWS credentials found\".","triggerScenarios":"Calling any awsFetch-backed SDK function (bus.publish, task.run/describe/stop) with no `aws` option, no AWS_* key env vars, and no AWS_CONTAINER_CREDENTIALS_RELATIVE_URI — i.e. running outside AWS without static credentials.","commonSituations":"Running code locally (unit tests, scripts) outside `sst dev`/`sst shell` without credentials; Lambda functions missing the container credentials env var; env vars stripped by the deploy target; typos in AWS_ACCESS_KEY_ID naming.","solutions":["Run under `sst dev` / `sst shell` locally so AWS credentials from your AWS profile are injected.","Export AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY (and AWS_SESSION_TOKEN, AWS_REGION) in your local environment.","Pass explicit credentials via the `aws` option: `{ aws: { accessKeyId, secretAccessKey, region } }`.","If running in AWS (Lambda/ECS), verify the runtime provides AWS_CONTAINER_CREDENTIALS_RELATIVE_URI and AWS_REGION."],"exampleFix":"// before (no creds locally)\nawait bus.publish(Resource.MyBus, event);\n// after\nawait bus.publish(Resource.MyBus, event, {\n  aws: {\n    accessKeyId: process.env.MY_AWS_KEY_ID!,\n    secretAccessKey: process.env.MY_AWS_SECRET!,\n    region: \"us-east-1\",\n  },\n});","handlingStrategy":"validation","validationCode":"if (!process.env.AWS_ACCESS_KEY_ID && !process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) {\n  throw new Error(\"Run via `sst dev`/`sst shell` or set AWS credentials before calling AWS-backed SDK functions\");\n}","typeGuard":"function hasAwsCredentials(): boolean {\n  return Boolean(\n    process.env.AWS_ACCESS_KEY_ID ||\n    process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI,\n  );\n}","tryCatchPattern":"try {\n  const c = await client();\n} catch (e) {\n  if (e instanceof Error && e.message === \"No AWS credentials found\") {\n    console.error(\"Provide credentials: sst shell, env vars, or the `aws` option\");\n  }\n  throw e;\n}","preventionTips":["Use `sst dev` or `sst shell` locally so credentials are automatically provided.","Set AWS_REGION along with key env vars to avoid follow-on region errors.","Prefer linked resources and IAM roles in AWS over hardcoding credentials."],"tags":["aws","credentials","environment","configuration"],"backgroundTag":"missing-aws-credentials","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}