how to config aws-s3 as storage
What happened?
I config the file https://github.com/toeverything/AFFiNE/blob/bd0279730c007895b1faae1220d669cc5f34c788/packages/backend/server/src/config/affine.ts#L108
as follow:
/* AWS S3 Plugin */
/* Enable if you choose to store workspace blobs or user avatars in AWS S3 Storage Service */
AFFiNE.use('aws-s3', {
credentials: {
accessKeyId: '',
secretAccessKey: '',
})
/* Update the provider of storages */
AFFiNE.storages.blob.provider = 'aws-s3';
AFFiNE.storages.avatar.provider = 'aws-s3';
but error:
affine_selfhosted | [Nest] 196 - 07/21/2024, 10:45:37 AM ERROR [QuotaManagementService] Failed to get workspace size: Error: Failed to list objects with prefix `61566fbc-6b4d-47dc-a0e8-926138e77191/`
affine_selfhosted | [Nest] 196 - 07/21/2024, 10:45:37 AM ERROR [GraphQL] Internal server error
affine_selfhosted | Error: Failed to put object `61566fbc-6b4d-47dc-a0e8-926138e77191/_X919lCWqgeCxDhcM2tk-KmB8Xe85bsfokKvswQsh7A=`
affine_selfhosted | at S3StorageProvider.put (file:///app/dist/plugins/storage/providers/s3.js:35:19)
affine_selfhosted | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
affine_selfhosted | at async WorkspaceBlobStorage.put (file:///app/dist/core/storage/wrappers/blob.js:21:9)
affine_selfhosted | at async WorkspaceBlobResolver.setBlob (file:///app/dist/core/workspaces/resolvers/blob.js:96:9)
the same with cloudflare-r2
affine_selfhosted | [Nest] 196 - 07/21/2024, 10:58:23 AM ERROR [GraphQL] Internal server error
affine_selfhosted | Error: Failed to list objects with prefix `be28afaf-066d-4966-bafa-4812dbcdb982/`
affine_selfhosted | at R2StorageProvider.list (file:///app/dist/plugins/storage/providers/s3.js:105:19)
affine_selfhosted | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
affine_selfhosted | at async WorkspaceBlobStorage.list (file:///app/dist/core/storage/wrappers/blob.js:32:23)
Distribution version
Linux
What browsers are you seeing the problem on if you're using web version?
No response
Are you self-hosting?
- [x] Yes
Relevant log output
No response
Anything else?
No response
Issue Status: 🆕 *Untriaged
*🆕 Untriaged
The team has not yet reviewed the issue. We usually do it within one business day. Docs: https://github.com/toeverything/AFFiNE/blob/canary/docs/issue-triaging.md
This is an automatic reply by the bot.
Hi, After hours check the source codes to solve this u need to create bucket called "blobs" in R2 as mentioned in this files
export function getDefaultAFFiNEStorageConfig(): AFFiNEStorageConfig {
return {
providers: {
fs: {
path: join(homedir(), '.affine/storage'),
},
},
storages: {
avatar: {
provider: 'fs',
bucket: 'avatars',
publicLinkFactory: key => `/api/avatars/${key}`,
},
blob: {
provider: 'fs',
bucket: 'blobs',
},
copilot: {
provider: 'fs',
bucket: 'copilot',
},
},
};
}
packages/backend/server/src/fundamentals/storage/config.ts