Skip to content

Commit

Permalink
Merge pull request alibaba#1078 from alibaba/wss/fix-package-bucket-r…
Browse files Browse the repository at this point in the history
…egion-tip-1

fix(package/check-bucket-region): fun package check oss region
  • Loading branch information
rsonghuster authored Feb 4, 2021
2 parents 1364205 + ffd2da4 commit 94f5b6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/oss.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ async function bucketExist(ossClient, bucketName) {
let bucketExist = false;

try {
await ossClient.getBucketLocation(bucketName);
const { location } = await ossClient.getBucketLocation(bucketName);
const { defaultRegion } = await getProfile();
if (location !== `oss-${defaultRegion}`) {
throw new Error(`\nThe current oss-bucket region is ${location}, which is different from the configured region ${defaultRegion}.\n`);
}
bucketExist = true;
} catch (ex) {

Expand Down

0 comments on commit 94f5b6b

Please sign in to comment.