tinify / tinify-nodejs

Node.js client for the Tinify API.
https://tinypng.com/developers
MIT License
421 stars 74 forks source link

the Store function throw an error with 'ServerError: The bucket does not allow ACLs. (HTTP 500/Storage failed).' #47

Closed rumaniel closed 4 months ago

rumaniel commented 9 months ago

Hello Team.

I finally found your awesome solution so I tried to implement the solution to upload to S3.

tinifyResult.store({
        service: "s3",
        aws_access_key_id: this.accessKeyId,
        aws_secret_access_key: this.secretAccessKey,
        region: this.region,
        path: `${this.bucket}/${s3Path}`,
      })

But I got an error with "ServerError: The Bucket does not allow ACLs. (HTTP 500/Storage failed)".

The IAM has the following permissions.

        Effect = "Allow",
        Action = [
          "s3:GetObject",
          "s3:GetObjectAcl",
          "s3:DeleteObject",
          "s3:PutObject",
          "s3:PutObjectAcl"
        ],

But the Bucket and objects have no public access. The objects are distributed via CloudFront. So the end users can access on CDN.

In this case, how can I resolve this problem?

Optionally, I checked that I can upload via the aws s3 plugin. So it's possible to tinify it locally and upload via the s3 plugin.

Thanks.

tinify-support commented 9 months ago

Hello,

Currently the Tinify API is only able to store the image on buckets that do not block public access. We are planning to fix this in the future but sadly right now it will only work with 'block public access' disabled.

PabloPerezDeCiriza commented 5 months ago

Hello! We have introduced a new optional parameter called "acl" for the API. This parameter can be configured to "no-acl" in order to enable storage without public permissions or ACL settings.

You can find more details it in the API documentation.

rumaniel commented 4 months ago

Cool. I tested it with "no-acl" configured and checked it works correctly.

Thank you for your support with an awesome solution.

I'll close this issue.