{"record":{"id":"7af839975cf8bb4a","repo":"weaviate/weaviate","slug":"aws-access-key-7af839","errorCode":null,"errorMessage":"AWS Access Key","messagePattern":"AWS Access Key","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/modulecomponents/clients/aws/aws.go","lineNumber":254,"sourceCode":"\t\t}\n\t}\n\tif len(images) > 0 {\n\t\t_, imageEmbeddings, err = c.vectorize(ctx, nil, images, settings)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &modulecomponents.VectorizationCLIPResult[[]float32]{\n\t\tTextVectors:  textEmbeddings,\n\t\tImageVectors: imageEmbeddings,\n\t}, nil\n}\n\nfunc (c *Client) vectorize(ctx context.Context, texts, images []string, settings Settings,\n) ([][]float32, [][]float32, error) {\n\taccessKey, err := c.getAwsAccessKey(ctx)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"AWS Access Key\")\n\t}\n\tsecretKey, err := c.getAwsAccessSecret(ctx)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"AWS Secret Key\")\n\t}\n\tawsSessionToken, err := c.getAwsSessionToken(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tmaxRetries := 5\n\n\tif settings.Service == Bedrock {\n\t\treturn c.sendBedrockRequest(ctx, texts, images, accessKey, secretKey, awsSessionToken, maxRetries, settings)\n\t} else {\n\t\treturn c.sendSagemakerRequest(ctx, texts, accessKey, secretKey, awsSessionToken, maxRetries, settings)\n\t}\n}\n","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/modulecomponents/clients/aws/aws.go#L236-L272","documentation":"This is the wrapper applied when the AWS embedding client (multi2vec-bedrock / text2vec-sagemaker / generative-aws) cannot resolve an AWS access key. `getAwsAccessKey` first checks the per-request context header `X-Aws-Access-Key`, then the server-level configured key; if both are empty it returns \"no access key found ...\", which vectorize wraps as \"AWS Access Key: no access key found\". Without credentials the client cannot sign the Bedrock/SageMaker request, so vectorization is refused before any API call.","triggerScenarios":"Any vectorization through the AWS module (Vectorize, VectorizeQuery, VectorizeMultiModal, imports and nearText/nearImage searches) when neither the request header `X-Aws-Access-Key` nor the module configuration (e.g. AWS_ACCESS_KEY env var / moduleConfig) provides an access key. The same request will next fail on 'AWS Secret Key' if the secret is also missing.","commonSituations":"Deployments where the operator expected instance-profile/IRSA credentials but the module only supports static keys; headers set on imports but forgotten on search requests (or stripped by a proxy/gateway); keys set for the wrong module or misspelled env var names; migrating from header-based auth after a version change.","solutions":["Send `X-Aws-Access-Key` (and `X-Aws-Secret-Key`, optionally `X-Aws-Session-Token`) headers with every request that triggers AWS vectorization — imports AND queries.","Or configure static credentials server-side via the module's environment variables (e.g. AWS_ACCESS_KEY / CLUSTER-level module config) so clients need not send headers.","Confirm no reverse proxy or load balancer strips the X-Aws-* headers, and that the header names are exact and case-correct per the module docs.","Note the module requires static keys — AWS IAM role-based credential chains are not consulted here, so ensure the env values are actually present in the Weaviate container."],"exampleFix":"// before: query without credentials\nresult, err := client.GraphQL().Get().WithNearText(nearText).Do(ctx)\n// err: \"AWS Access Key: no access key found\"\n// after: supply per-request AWS headers\nresult, err := client.GraphQL().Get().WithNearText(nearText).\n  WithHeaders(map[string]string{\n    \"X-Aws-Access-Key\": os.Getenv(\"AWS_ACCESS_KEY\"),\n    \"X-Aws-Secret-Key\": os.Getenv(\"AWS_SECRET_KEY\"),\n  }).Do(ctx)","handlingStrategy":"validation","validationCode":"// run BEFORE any AWS-module vectorization call\nif os.Getenv(\"AWS_ACCESS_KEY\") == \"\" && requestHeaders.Get(\"X-Aws-Access-Key\") == \"\" {\n  return fmt.Errorf(\"precondition failed: set X-Aws-Access-Key header or AWS_ACCESS_KEY env var\")\n}\nif os.Getenv(\"AWS_SECRET_KEY\") == \"\" && requestHeaders.Get(\"X-Aws-Secret-Key\") == \"\" {\n  return fmt.Errorf(\"precondition failed: set X-Aws-Secret-Key header or AWS_SECRET_KEY env var\")\n}","typeGuard":"func hasAwsCredentials(ctx context.Context, headers http.Header) bool {\n  return modulecomponents.GetValueFromContext(ctx, \"X-Aws-Access-Key\") != \"\" ||\n    os.Getenv(\"AWS_ACCESS_KEY\") != \"\" ||\n    headers.Get(\"X-Aws-Access-Key\") != \"\"\n}","tryCatchPattern":"result, err := client.GraphQL().Get().WithNearText(nearText).\n  WithHeaders(awsHeaders).Do(ctx)\nif err != nil {\n  if strings.Contains(err.Error(), \"AWS Access Key\") || strings.Contains(err.Error(), \"AWS Secret Key\") {\n    // do not retry — credentials are missing; refresh keys and fail fast\n    return nil, fmt.Errorf(\"missing AWS credentials: %w\", err)\n  }\n  return nil, err\n}","preventionTips":["Configure static AWS keys in the Weaviate module env so every request has credentials.","If using header auth, attach X-Aws-Access-Key/X-Aws-Secret-Key to BOTH import and search requests.","Check proxies/gateways do not strip X-Aws-* headers.","Remember the module does not use IAM instance profiles — verify env vars inside the container, not on the host."],"tags":["go","weaviate","aws","credentials","vectorization"],"backgroundTag":"missing-aws-credentials","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}