This repository was archived by the owner on Jan 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed
packages/serverless-components Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ class CloudFront extends Component {
23
23
async default ( inputs : any = { } ) {
24
24
this . context . status ( "Deploying" ) ;
25
25
26
- inputs . region = inputs . region || "us-east-1" ;
26
+ inputs . region = inputs . region ?? "us-east-1" ;
27
+ inputs . bucketRegion = inputs . bucketRegion ?? "us-east-1" ; // S3 client needs to be specific to the bucket region
27
28
inputs . enabled = inputs . enabled !== false ;
28
29
inputs . comment =
29
30
inputs . comment === null || inputs . comment === undefined
@@ -57,7 +58,7 @@ class CloudFront extends Component {
57
58
58
59
const s3 = new AWS . S3 ( {
59
60
credentials : this . context . credentials . aws ,
60
- region : inputs . region
61
+ region : inputs . bucketRegion
61
62
} ) ;
62
63
63
64
this . state . id = inputs . distributionId || this . state . id ;
Original file line number Diff line number Diff line change @@ -310,6 +310,7 @@ describe.each`
310
310
311
311
it ( "creates distribution" , ( ) => {
312
312
expect ( mockCloudFront ) . toBeCalledWith ( {
313
+ bucketRegion : "us-east-1" ,
313
314
defaults : {
314
315
allowedHttpMethods : [
315
316
"HEAD" ,
Original file line number Diff line number Diff line change @@ -911,6 +911,7 @@ class NextjsComponent extends Component {
911
911
delete defaultLambdaAtEdgeConfig [ "origin-response" ] ;
912
912
913
913
const cloudFrontOutputs = await cloudFront ( {
914
+ bucketRegion : bucketRegion ,
914
915
distributionId : cloudFrontDistributionId ,
915
916
defaults : {
916
917
minTTL : 0 ,
You can’t perform that action at this time.
0 commit comments