Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetObjectCommand not working with IAM roles #6773

Open
3 of 4 tasks
randhirsingh0578 opened this issue Jan 3, 2025 · 2 comments
Open
3 of 4 tasks

GetObjectCommand not working with IAM roles #6773

randhirsingh0578 opened this issue Jan 3, 2025 · 2 comments
Assignees
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Comments

@randhirsingh0578
Copy link

randhirsingh0578 commented Jan 3, 2025

Checkboxes for prior research

Describe the bug

const REGION = "us-east-2";
const config = {
  region: REGION,
}
const s3config = {
  region: PUBLIC_AWS_REGION,
  credentials:{
    accessKeyId: "exampleacessid",
    secretAccessKey: "examplesecretid"
  }
}
const s3Client = new S3Client(config);
export const retrieveBucketObjList = async (bucket) => {
  const command = new ListObjectsV2Command({Bucket: bucket});
  try{
    const bucketObjs = await s3Client.send(command);
    return bucketObjs?.Contents;
  }catch(error){
    return {error:error.message};
  }
}

export const retrieveBucketObj = async (bucket, key) => {
  const command = new GetObjectCommand({Bucket: bucket, Key: key});
  try{
    const object = await s3Client.send(command);
    return object;
  }catch(error){
    return {error:error.message}
  }
}

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/client-s3 3.721.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v20.12.0

Reproduction Steps

  1. Install aws/client-s3 sdk
  2. Run this code `given```

Observed Behavior

GetObjectCommand not working with IAM role policy throwing error Credential is missing while ListObjectsv2Command does not throw that GetObjectCommand properly work when i give s3config with hardcoded access and secret access keys it works perfectly

Expected Behavior

GetObjectCommand should work with IAM role provided secret and access keys as ListObjectsV2Command is working properly with IAM roles and permission for s3 bucket in IAM role and even bucket policy is properly configured checked that as well

Possible Solution

No response

Additional Information/Context

No response

@randhirsingh0578 randhirsingh0578 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 3, 2025
@zshzbh zshzbh self-assigned this Jan 3, 2025
@zshzbh zshzbh removed the needs-triage This issue or PR still needs to be triaged. label Jan 3, 2025
@zshzbh
Copy link
Contributor

zshzbh commented Jan 3, 2025

Could you please copy&paste the permissions and trust relationships of this role?

Thanks!
Maggie

@zshzbh zshzbh added p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. labels Jan 3, 2025
Copy link

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants