payload icon indicating copy to clipboard operation
payload copied to clipboard

plugin-cloud-storage: Uploading files returns 201, even if upload to S3 fails

Open carlassmann opened this issue 2 years ago • 3 comments

Link to reproduction

No response

Describe the Bug

I'm currently developing with MinIO and MongoDB locally using their Docker Images. When setting everything up I noticed my uploading requests succeed without the file being uploaded to MinIO.

[17:47:27] ERROR (payload): The specified bucket does not exist
    err: {
      "type": "NoSuchBucket",
      "message": "The specified bucket does not exist",
      "stack":
          NoSuchBucket: The specified bucket does not exist
              at de_NoSuchBucketRes (/myproject/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:4800:21)
              at de_CommandError (/myproject/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:4741:19)
              at processTicksAndRejections (node:internal/process/task_queues:95:5)
              at async /myproject/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
              at async /myproject/node_modules/@aws-sdk/middleware-signing/dist-cjs/index.js:225:18
              at async /myproject/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
              at async /myproject/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/index.js:173:18
              at async /myproject/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:97:20
              at async /myproject/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:120:14
              at async /myproject/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
      "name": "NoSuchBucket",
      "$fault": "client",
      "$metadata": {
        "httpStatusCode": 404,
        "requestId": "17BD4C978EA11152",
        "extendedRequestId": "dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8",
        "attempts": 1,
        "totalRetryDelay": 0
      },
      "Code": "NoSuchBucket",
      "Key": "avatars/MWGN9juwLQCjWnAUlaWss-128x128.jpg",
      "BucketName": "my-bucket",
      "Resource": "/my-bucket/avatars/MWGN9juwLQCjWnAUlaWss-128x128.jpg",
      "RequestId": "17BD4C978EA11152",
      "HostId": "dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8"
    }
POST /api/avatars 201 - - 75.622 ms

It does not matter why the upload to the cloud storage fails. But the POST Request uploading the file is "successfull".

To Reproduce

  • Create a Collection with uploads enabled
  • configure the S3 adapter with invalid credentials
  • upload a file

Payload Version

2.11

Adapters and Plugins

[email protected]

carlassmann avatar Mar 16 '24 17:03 carlassmann

I've just come across this with the Azure adapter as well. Lots of errors in the logs (I didn't have a collection configured in the clout storage plugin) but all my uploads show as succeeded in the admin panel! I assume processing the upload is asynchronous but ideally the upload would fail if the file is not written.

I'm on @payloadcms/plugin-cloud-storage 1.1.2 and payload 2.11.2

mrobst avatar Aug 28 '24 16:08 mrobst

This issue was automatically closed due to lack of activity. If this issue is still relevant against the latest codebase, please create a new issue.

github-actions[bot] avatar Dec 06 '24 15:12 github-actions[bot]

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Dec 09 '24 04:12 github-actions[bot]