Good afternoon. I tried to configure _APP_STORAGE_S3_ENDPOINT, Appwrite version 1.7.0. I tried two different providers, but on both I encountered an access error or a lack of Bucket. All accesses and stuff have been checked manually, there are no problems. Apparently, when using _APP_STORAGE_S3_ENDPOINT, Appwrite does not handle _APP_STORAGE_S3_BUCKET correctly.
The screenshots are my tests of two S3-compatible providers.
The settings of the first one are _APP_STORAGE_S3_ENDPOINT=storage.yandexcloud.net
{"message":"Storage bucket with the requested ID could not be found.","code":404,"type":"storage_bucket_not_found","version":"1.7.0"}
Settings of the second one: _APP_STORAGE_S3_ENDPOINT=s3.twcstorage.ru
{"message":"Storage bucket with the requested ID could not be found.","code":404,"type":"storage_bucket_not_found","version":"1.7.0"}
I tried to make changes to the project code. If you change the file app/init.php from 1523 to 1572, the line is as follows, then everything works without problems.
if (!empty($connection)) {
$acl = 'private';
$device = Storage::DEVICE_LOCAL;
$accessKey = '';
$accessSecret = '';
$bucket = '';
$region = '';
$endPoint = 's3.twcstorage.ru';
try {
$dsn = new DSN($connection);
$device = $dsn->getScheme();
$accessKey = $dsn->getUser() ?? '';
$accessSecret = $dsn->getPassword() ?? '';
$bucket = $dsn->getPath() ?? '';
$region = $dsn->getParam('region');
} catch (\Throwable $e) {
Console::warning($e->getMessage() . 'Invalid DSN. Defaulting to Local device.');
}
switch ($device) {
case Storage::DEVICE_S3:
return new S3($root, $accessKey, $accessSecret, $bucket, $region, $acl, 's3.twcstorage.ru');
case STORAGE::DEVICE_DO_SPACES:
$device = new DOSpaces($root, $accessKey, $accessSecret, $bucket, $region, $acl);
$device->setHttpVersion(S3::HTTP_VERSION_1_1);
return $device;
case Storage::DEVICE_BACKBLAZE:
return new Backblaze($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case Storage::DEVICE_LINODE:
return new Linode($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case Storage::DEVICE_WASABI:
return new Wasabi($root, $accessKey, $accessSecret, $bucket, $region, $acl);
case Storage::DEVICE_LOCAL:
default:
return new Local($root);
}
} else {
switch (strtolower(System::getEnv('_APP_STORAGE_DEVICE', Storage::DEVICE_LOCAL) ?? '')) {
case Storage::DEVICE_LOCAL:
default:
return new Local($root);
case Storage::DEVICE_S3:
$s3AccessKey = System::getEnv('_APP_STORAGE_S3_ACCESS_KEY', '');
$s3SecretKey = System::getEnv('_APP_STORAGE_S3_SECRET', '');
$s3Region = System::getEnv('_APP_STORAGE_S3_REGION', '');
$s3Bucket = System::getEnv('_APP_STORAGE_S3_BUCKET', '');
$s3EndPoint = 's3.twcstorage.ru';
$s3Acl = 'private';
return new S3($root, $s3AccessKey, $s3SecretKey, $s3Bucket, $s3Region, $s3Acl, $s3EndPoint);```
S3 Bucket Error
Was this previously working on 1.6.2?
In version 1.6.2, _APP_STORAGE_S3_ENDPOINT did not work, the documentation also states that you should use >1.7 The code that I have attached works in 1.6.2
Oh, whoops - sorry
FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting).
Thanks, I've updated the code)
Recommended threads
- script "build" was terminated by signal ...
Heyo, For some reason, my Next.js 16.0.10 version does not build properly. Here is the last logs: ``` 1063 packages installed [22.54s] $ next build ⚠ No build...
- Auth not working on expo react native
I'm trying to launch a development server with expo go and appwrite as a backend. On my windows pc, I've got a local docker instance of appwrite running as my b...
- Urgent help required - Could not resolve...
I upgraded my production environment to 1.8.0 but experienced issues with appwrite running out of worker threads. I downgraded back to 1.6.1 and restored the da...