Skip to content

Commit

Permalink
fix: add default expectedBucketOwner to S3 config
Browse files Browse the repository at this point in the history
  • Loading branch information
erinleigh90 committed Aug 21, 2024
1 parent 9fe293d commit 4d46cd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/core/src/singleton/Storage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ export interface BucketInfo {
bucketName: string;
/** Region of the bucket */
region: string;
/** Expected owner of the bucket */
expectedBucketOwner?: string;
}
export interface S3ProviderConfig {
S3: {
bucket?: string;
region?: string;
expectedBucketOwner?: string;
/**
* Internal-only configuration for testing purpose. You should not use this.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ export const resolveS3ConfigAndInput = async (
const {
bucket: defaultBucket,
region: defaultRegion,
expectedBucketOwner: defaultBucketOwner,
dangerouslyConnectToHttpEndpointForTesting,
buckets,
} = amplify.getConfig()?.Storage?.S3 ?? {};

const {
bucket = defaultBucket,
region = defaultRegion,
expectedBucketOwner,
expectedBucketOwner = defaultBucketOwner,
} = (apiOptions?.bucket && resolveBucketConfig(apiOptions, buckets)) || {};

assertValidationError(!!bucket, StorageValidationErrorCode.NoBucket);
Expand Down

0 comments on commit 4d46cd8

Please sign in to comment.