Closed Christopher-Hayes closed 1 year ago
Hi, maybe you could help us improving the documebtation by submitting a PR to https://github.com/nextcloud/documentation/edit/master/admin_manual/configuration_files/external_storage/amazons3.rst?
Thans a lot!
Fixed by nextcloud/documentation#10443
Hi @Christopher-Hayes - This has been addressed. The latest docs are much more extensive:
⚠️ This issue respects the following points: ⚠️
Bug description
I have a pre-existing AWS S3 bucket in the
us-east-1
region. Connecting it in the "files_external" admin settings by supplying the "bucket name" always fails. The error is a "409 conflict" - Nextcloud is trying to create a NEW bucket. It's also strangely trying to create the bucket in the "eu-west-1" region.What might be happening:
eu-west-1
regionus-east-1
, so a bucket with the same name cannot be created ineu-west-1
Related - I know if I let Nextcloud create a new bucket with a name that doesn't exist, it always creates the bucket in the
eu-west-1
region.Fix - The fix to this issue is to just set the
region
field (in my caseus-east-1
). But, between the weird error and the documentation makingregion
sound optional for connecting buckets, it wasn't immediately obvious that I needed to set the region.Steps to reproduce
Expected behavior
The "region" field is considered optional by Nextcloud documentation. If "region" is optional, then a user would expect Nextcloud to figure out which region a bucket is in by its globally unique bucket name.
If it's not practical to patch the "files_external" app to find which region a bucket is in, then an alternative solution would be to update the external storage AmazonS3 documentation to make it clear that the "region" field is required for pre-existing buckets: https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage/amazons3.html
Installation method
Community Manual installation with Archive
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.1
Web server
Nginx
Database engine version
MySQL
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
Ran into this issue on both v24 and v25. Previously had a v24 Snap install. The workaround was to just let Nextcloud create a new bucket. I didn't realize Nextcloud put the bucket in
eu-west-1
. After moving to a v25 manual install, I tried to fix this by creating aus-east-1
bucket in AWS and switch to that. Ran into the same issue; however, this time I did try to explicitly set theregion
tous-east-1
, which fixed the error.Source code: This is where the
eu-west-1
default is coming from. Based on that, it doesn't search for the bucket, to just defaults toeu-west-1
if the bucket region is not supplied: https://github.com/nextcloud/server/blob/e4e20bf40ad8ca139655b36a6efa2b1710ae50f0/lib/private/Files/ObjectStore/S3ConnectionTrait.php#L86Seems like GetBucketLocation, or HeadBucket would be needed if the app was to figure out the region of pre-existing buckets before creating
S3Client
. Those APIs use the "List buckets" permission to return the bucket region (user must own the bucket). I'm not 100% sure how it would fit intoS3ConnectionTrait.php
because connections to AWS are made usingS3Client
and theS3Client
needs the region for the constructor to work.@icewind1991 it looks like you've worked on the External Storage app before. You might be able to speak to whether updating the s3 code to check for bucket location is worth the dev time, or updating documentation about this gotcha would be better.