Deleting multiple Objects in Tigris - Tigris

Deleting multiple Objects in Tigris

Yes, a presigned URL can only authorize one S3 operation.

The DeleteObjects API (which deletes several keys in one call) is not supported by the presigning helpers, so a URL generated for it cannot be used successfully.

Why the request fails

When the SDK creates the signature it signs only the headers that are allowed for the operation.

DeleteObjects requires a request body that contains the list of keys, but a presigned URL can only sign query‑string parameters – it can’t sign the body. Consequently the request you send contains extra headers/body data that weren’t part of the signature, and S3 returns:

There were headers present in the request which were not signed

What you can do

* Delete a single object– use GetObjectCommand or DeleteObjectCommand with getSignedUrl.

* Delete multiple objects– either:

  1. Call the API directly from a trusted backend (no presigned URL needed), or

  2. Use a POST request with a policy document that lists the objects to delete. This is more involved and still requires a backend to generate the policy and signature.

Example: delete a single object with a presigned URL

import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import { DeleteObjectCommand, S3Client } from "@aws-sdk/client-s3";

const s3 = new S3Client({ region: "us-east-1" });

const url = await getSignedUrl(
  s3,
  new DeleteObjectCommand({
    Bucket: process.env.BUCKET_NAME,
    Key: "path/to/object.txt",
  }),
  { expiresIn: 3600 }   // seconds
);

// The client can now issue a DELETE request to `url`.

Bottom line

Presigned URLs cannot be used for DeleteObjects (multiple‑object delete). Use a server‑side call or a signed POST policy if you need batch deletion.