Skip to content

bug: CallAwsService S3 putObject malforms JSON body in Step Functions #12030

@gerson24

Description

@gerson24

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I’ve encountered an issue when using the CallAwsService integration in Step Functions to upload a JSON object to S3. Here’s a minimal example to reproduce the problem:

new CallAwsService(this, 'Write json file', {
  service: 's3',
  action: 'putObject',
  parameters: {
    Bucket: 'bucket',
    Key: 'test.json',
    ContentType: 'application/json',
    Body: {
      id: 'id',
      foo: 'bar'
    }
  },
  iamResources: ['*']
});

When this step executes, the file stored in S3 is not valid JSON. The body appears malformed, with : characters swapped with , and vice versa.
Here is the actual result stored in S3:

{"id","id":"foo","bar"}

Expected Behavior

The expected result should look like this:

{"id":"id","foo":"bar"}

How are you starting LocalStack?

With the localstack script

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

IMAGE_NAME=localstack/localstack:latest localstack start --no-banner

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

1.	Create a Step Function with the above CallAwsService step.
2.	Execute the Step Function in LocalStack.
3.	Retrieve the file from S3 using aws s3api get-object or equivalent.

Environment

- OS: macOS Sequoia 15.1.1
- LocalStack version: latest

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions