0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(core): s3 region fallback (#4049)

Signed-off-by: Danil Tankov <danil.tankoff@yandex.ru>
This commit is contained in:
Danil Tankov 2023-06-19 13:15:07 +07:00 committed by GitHub
parent 160f861800
commit 2d7c0aa3c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,11 +9,7 @@ export const buildS3Storage = (
secretAccessKey: string
) => {
// Endpoint example: s3.us-west-2.amazonaws.com
const region = /s3\.([^.]*)\.amazonaws/.exec(endpoint)?.[1];
if (!region) {
throw new Error('Invalid S3 endpoint, can not find region');
}
const region = /s3\.([^.]*)\.amazonaws/.exec(endpoint)?.[1] ?? 'us-east-1';
const client = new S3Client({
region,