sambecker / exif-photo-blog

Photo blog, reporting 🤓 EXIF camera details (aperture, shutter speed, ISO) for each image.
https://photos.sambecker.com
644 stars 92 forks source link

Is it possible to use the gallery without the s3:PutObjectACL policy? #88

Closed metgen closed 2 months ago

metgen commented 2 months ago

Hello! I was able to connect aws s3 compatible storage to this project. But I encountered a problem, when I try to upload a photo, it is uploaded to the bucket and appears in the uploads section without preview, but when I click the "create" or "add" button, I get an error. I see the following errors in the Vercel logs.

InvalidArgument: Copy Source must mention the source bucket and key: sourcebucket/sourcekey
    at throwDefaultError (/var/task/node_modules/.pnpm/@smithy+smithy-client@2.5.1/node_modules/@smithy/smithy-client/dist-cjs/index.js:838:20)
    at /var/task/node_modules/.pnpm/@smithy+smithy-client@2.5.1/node_modules/@smithy/smithy-client/dist-cjs/index.js:847:5
    at de_CommandError (/var/task/node_modules/.pnpm/@aws-sdk+client-s3@3.564.0/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:4756:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /var/task/node_modules/.pnpm/@smithy+middleware-serde@2.3.0/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
    at async /var/task/node_modules/.pnpm/@aws-sdk+middleware-signing@3.556.0/node_modules/@aws-sdk/middleware-signing/dist-cjs/index.js:225:18
    at async /var/task/node_modules/.pnpm/@smithy+middleware-retry@2.3.1/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
    at async /var/task/node_modules/.pnpm/@aws-sdk+middleware-sdk-s3@3.556.0/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:97:20
    at async /var/task/node_modules/.pnpm/@aws-sdk+middleware-sdk-s3@3.556.0/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:120:14
    at async /var/task/node_modules/.pnpm/@aws-sdk+middleware-logger@3.535.0/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22 {
  '$fault': 'client',
  '$metadata': {
    httpStatusCode: 400,
    requestId: 'a0c3811f-2184-43d4-a400-dd5c8d9e9506',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
  Code: 'InvalidArgument',
  Resource: '/photo-Sc3H2LX3.jpg',
  RequestId: 'a0c3811f-2184-43d4-a400-dd5c8d9e9506',
  digest: '313664440'
}

and

[POST] /admin/uploads/https%3A%2F%2Fexif-photo-blog.s3.ru-1.storage.selcloud.ru%2Fupload-L4lCaYGEUDejYClj.jpg?nxtPuploadPath=https%3A%2F%2Fexif-photo-blog.s3.ru-1.storage.selcloud.ru%2Fupload-L4lCaYGEUDejYClj.jpg status=500

This may be due to the fact that the storage does not support the "s3:PutObjectACL" policy action. Are there any workarounds?

sambecker commented 2 months ago

Technically, it should work without s3:PutObjectACL so long as you are defining those permissions somewhere else.

The Cloudflare example, which does exactly that, might be a better pattern to follow.