Error when delete object from workers using @aws-s...
# r2
p
Hello, I'm getting FileReader errors when I try to delete any object in R2 with the @aws-sdk/client-s3, Create, list works prefectly but delete get a 'File Reader error'
Copy code
ReferenceError: FileReader is not defined
  Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
    at worker.js:8882:20
    at new Promise (<anonymous>)
    at readToBase64 (worker.js:8881:10)
    at collectBlob (worker.js:8860:24)
    at Object.streamCollector (worker.js:8855:12)
    at collectBody (worker.js:8961:31)
    at de_DeleteObjectCommand (worker.js:10825:9)
    at deserialize (worker.js:11343:12)
    at worker.js:7686:26
    at async worker.js:6288:18 {
  $metadata: Object,
  stack: ReferenceError: FileReader is not defined
  Deseri… worker.js:7686:26
    at async worker.js:6288:18,
  message: FileReader is not defined
  Deserialization error:…he hidden field {error}.$response on this object.,
  $response: HttpResponse
}
Anyone has seen this on the past?
Code:
Copy code
try {
            const aws = await S3.send(new DeleteObjectCommand({ Bucket: bucketName, Key: objectName }));
            return new Response(JSON.stringify(aws));
        } catch (err) {
            console.log(JSON.stringify(err));
        }
c
The error is pretty clear. the response from .send or the error is not String-able.
r
Had the same issue.. found this: https://github.com/aws/aws-sdk-js-v3/issues/4576#issuecomment-1489284915 my code is :
Copy code
const res = await s3.send(new DeleteObjectCommand(params))
      .catch((_) => _) /* hack to get this to hide the error */
    if(res.$response.statusCode !== 204) {
      throw new Error(`Error deleting file: ${file.id}`)
    }
4 Views