Skip to content

Presigned POST does not apply x-amz-tagging to uploaded S3 object #7154

@johnnybishop

Description

@johnnybishop

Checkboxes for prior research

Describe the bug

Description

When uploading an object to S3 using a presigned POST URL generated with the AWS SDK for JavaScript (v3), the object is uploaded successfully and metadata fields (e.g. x-amz-meta-*) are applied, but tags specified via x-amz-tagging are not applied to the object.

According to the documentation, it should be possible to specify tags using x-amz-tagging during upload. However, this appears to be silently ignored when using a presigned POST, even though the same tag string works with PUT presigned URLs.

SDK Version

"@aws-sdk/client-s3": "^3.825.0"
"@aws-sdk/s3-presigned-post": "^3.825.0"

Please advise whether this is a bug, an unsupported feature for presigned POST, or if we are misusing the SDK. If unsupported, we recommend clarifying this in the SDK and S3 documentation.

Regression Issue

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

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

22.9.0

Reproduction Steps

import {
  GetObjectCommand,
  HeadObjectCommandOutput,
  PutObjectCommand,
  PutObjectCommandInput,
  S3,
} from '@aws-sdk/client-s3';
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
import {
  createPresignedPost,
  PresignedPostOptions,
} from '@aws-sdk/s3-presigned-post';
import { createReadStream } from 'fs';
import FormData from 'form-data';

const tagString = 'tag1=abcd&tag2=efgh';

const options: PresignedPostOptions = {
  Bucket: 'my-bucket',
  Key: 'test-object.json',
  Expires: 3600,
  Conditions: [
    ['content-length-range', 0, 10485760], // 10MB max
    { bucket: 'my-bucket' },
    { key: 'test-object.json' },
    { 'x-amz-tagging': tagString }, // included in conditions
  ],
  Fields: {
    'x-amz-tagging': tagString, // included in form fields
  },
};

const { url, fields } = await createPresignedPost(s3Client, options);

const form = new FormData();
for (const [key, value] of Object.entries(fields)) {
  form.append(key, value);
}
form.append('file', fs.createReadStream('/Users/test/test.json'));

form.submit(url, (err, res) => {
  // Upload succeeds
});

Observed Behavior

After upload, the object exists but has no tags. The x-amz-tagging string does not take effect.

Expected Behavior

Tags passed via the x-amz-tagging field and allowed in policy conditions should be applied to the object during upload, as per documentation and the behavior with PUT presigned URLs.

Possible Solution

No response

Additional Information/Context

  • Using a PUT presigned URL with x-amz-tagging works correctly.
  • Lambda executing the code has full access to S3 service
  • No error is thrown — the upload appears successful, but tags are not applied.

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p3This is a minor priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions