Skip to content

[S3] contentEncoding is not working #27328

@unendingblue

Description

@unendingblue

What version of Bun is running?

1.3.9

What platform is your computer?

No response

What steps can reproduce the bug?

Support for S3 Content-Encoding was announced back in Bun 1.3.7, via #26149, but it does not work.

import { S3Client } from 'bun';

const s3Client = new S3Client({
  accessKeyId: 'accessKeyId',
  secretAccessKey: 'secretAccessKey',
  bucket: 'bucket',
  endpoint: 'endpoint',
});

await s3Client.write(`data.json`, Bun.gzipSync('some-content-here'), { contentEncoding: 'gzip' });
TS error:
Object literal may only specify known properties, and 'contentEncoding' does not exist in type 'S3Options'.

Ignoring the TS error, to verify this isn't simply a @types/bun issue I tried running the code regardless, and Content-Encoding does not get set.

What is the expected behavior?

contentEncoding should be added to @types/bun and the Content-Encoding header should be set when contentEncoding is defined in S3Options.

What do you see instead?

Content-Encoding is not being set when writing to the bucket via the S3 client, and the contentEncoding option is not visible in Bun's types.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions