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

HeadObjectCommand does not return user metadata #3446

Closed
funes79 opened this issue Mar 18, 2022 · 3 comments
Closed

HeadObjectCommand does not return user metadata #3446

funes79 opened this issue Mar 18, 2022 · 3 comments
Assignees
Labels
CORS Issue related to server-side CORS configuration.

Comments

@funes79
Copy link

funes79 commented Mar 18, 2022

Describe the bug

A clear and concise description of what the bug is.

Calling a simple head command on an existing Key does not return any metadata, neither system nor user metadata.

  const input = {
    Bucket: bucket,
    Key: key,
  };
  const clientS3 = new S3Client({
    region:  s3_bucket_region,
    credentials: userCredentials,
  });
  const command = new HeadObjectCommand(input);

Your environment

SDK version number

@aws-sdk/client-s3": "^3.54.1"

Is the issue in the browser/Node.js/ReactNative?

browser/React

Details of the browser/Node.js/ReactNative version

Paste output of npx envinfo --browsers or node -v or react-native -v

Steps to reproduce

Please share code or minimal repo, and steps to reproduce the behavior.

Observed behavior

A clear and concise description of what happens.

Expected behavior

A clear and concise description of what you were expecting to happen.

Screenshots

If applicable, add screenshots to help explain your problem.
image

Additional context

Add any other context about the problem here.

@funes79 funes79 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 18, 2022
@kuhe
Copy link
Contributor

kuhe commented Apr 6, 2022

hi @funes79 ,

Based on my reading of these docs:
https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManageCorsUsing.html for using ExposeHeaders
and
https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html for User-defined object metadata

You'll want to set ExposeHeaders in the bucket CORS configuration to allow it to show the metadata that you want. For user-defined metadata, that means the x-amz-meta-___ value that you've set on the object.

@kuhe kuhe added CORS Issue related to server-side CORS configuration. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 6, 2022
@funes79
Copy link
Author

funes79 commented Apr 7, 2022

Thanks for the tip. These are the current settings

        "ExposeHeaders": [
            "x-amz-server-side-encryption",
            "x-amz-request-id",
            "x-amz-id-2",
            "ETag"
        ],

I will change them and try again

@kuhe kuhe closed this as completed Apr 14, 2022
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CORS Issue related to server-side CORS configuration.
Projects
None yet
Development

No branches or pull requests

2 participants