Theo's Typesafe CultTTC
Theo's Typesafe Cult4y ago
1 reply
utdev

Presigned URL set acl?

I have a presigned url logic which uploads files successfully to my s3 bucket, but right now I can't view those files, I am getting an acl Access denied error. I am wondering how I can set that policy in my presigned url logic so far I did this without success:

    const conditions = [{ acl: 'public-read' }, ['content-length-range', 0, 10485760]];

    const result = <PresignedPostOutput>this.s3.createPresignedPost({
      Bucket: this.s3Bucket,
      Fields: {
        key: uniqueName,
        'Content-Type': filetype,
      },
      Expires: 60 * 5,
      Conditions: conditions,
    });


Frontend
      const formData = new FormData();

      Object.entries({ ...fields, file }).forEach(([key, value]) => {
        formData.append(key, value as string);
      });

      const upload = await fetch(url, {
        method: 'POST',
        body: formData,
      });

      if (upload.ok) {
Was this page helpful?