Skip to content

Fix S3 PutObject PermanentRedirect in Word document tools#674

Merged
ramenNoodles1998 merged 1 commit into
developfrom
fix/word-document-s3-region
Jul 17, 2026
Merged

Fix S3 PutObject PermanentRedirect in Word document tools#674
ramenNoodles1998 merged 1 commit into
developfrom
fix/word-document-s3-region

Conversation

@ramenNoodles1998

Copy link
Copy Markdown
Contributor

Follow-up to #670. The region fix commit was pushed after #670 had already squash-merged, so it never landed on develop. This cherry-picks it onto current develop. Resolves the user-files bucket region via HeadBucket (x-amz-bucket-region; uses s3:ListBucket, which the inference-api role has) and drops the hard-pinned endpoint_url, so PutObject no longer fails with PermanentRedirect in the AgentCore Runtime and presigned download URLs stay region-correct. ruff clean.

The user-files S3 client pinned its endpoint to https://s3.{AWS_REGION}.amazonaws.com. In the AgentCore Runtime AWS_REGION does not reliably match the bucket region, and the explicit endpoint_url disables botocore's automatic S3 region redirect, so PutObject failed with PermanentRedirect. Resolve the bucket's real region via HeadBucket (x-amz-bucket-region header; maps to s3:ListBucket, which the runtime role already has — GetBucketLocation is not granted) and pin the client to it, dropping the hardcoded endpoint_url. Fixes both the save and the presigned download URL region.
@ramenNoodles1998
ramenNoodles1998 merged commit d328c24 into develop Jul 17, 2026
4 checks passed
@philmerrell philmerrell mentioned this pull request Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants