Skip to content

S3 PutObjectCommand does not require the property Body, hangs request when no body is passed. #6989

@prenaissance

Description

@prenaissance

Checkboxes for prior research

Describe the bug

The type PutObjectCommandInput, passed as an argument to the constructor of PutObjectCommand, does not require the Body property. Sending the command makes the connection hang and eventually timeout.

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

v22.14.0

Reproduction Steps

const s3 = new S3Client(myOptions);
const s3Response = await s3.send(
   new PutObjectCommand({
     Bucket: 'some-bucket',
     Key: 'some-key',
     ContentType: 'application/zip',
   }),
); // this will hang and eventually timeout

Observed Behavior

Slightly edited error log message:

err: {
  "type": "Error",
  "message": "{\"path\":\"/program/welcome-letter-batch/d54cbc88-aae3-41a2-8d3a-0c35f2e2b111\",\"message\":\"Internal Server Error\"}",
  "stack":
      Error: Attribute 'lang' is without value.:2:7
        Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
          at XMLParser.parse ([my-path]/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js:30:21)
          at [my-path]/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js:177:26
          at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
          at async parseXmlErrorBody ([my-path]/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js:198:17)
          at async de_CommandError ([my-path]/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:4907:11)
          at async [my-path]/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
          at async [my-path]/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:484:18
          at async [my-path]/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
          at async [my-path]/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/index.js:318:18
          at async [my-path]/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:110:22
          at async [my-path]/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:137:14
          at async [my-path]/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
          ... project files
          at async [my-path]/node_modules/@nestjs/core/router/router-execution-context.js:46:28
}

Expected Behavior

I'm not sure why undefined is allowed as the value for the Body parameter, but if it is allowed I'd expect an empty object to be created.

Possible Solution

No response

Additional Information/Context

OS: MacOS 15.3.1
Architecture: ARM64 Apple Silicon
Using NestJS 11 and pino, which might have interfered with the error message. I'll try to get a sandboxed reproduction later.

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions