Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class CloudFront extends Component {
async default(inputs: any = {}) {
this.context.status("Deploying");

inputs.region = inputs.region || "us-east-1";
inputs.region = inputs.region ?? "us-east-1";
inputs.bucketRegion = inputs.bucketRegion ?? "us-east-1"; // S3 client needs to be specific to the bucket region
inputs.enabled = inputs.enabled !== false;
inputs.comment =
inputs.comment === null || inputs.comment === undefined
Expand Down Expand Up @@ -57,7 +58,7 @@ class CloudFront extends Component {

const s3 = new AWS.S3({
credentials: this.context.credentials.aws,
region: inputs.region
region: inputs.bucketRegion
});

this.state.id = inputs.distributionId || this.state.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ describe.each`

it("creates distribution", () => {
expect(mockCloudFront).toBeCalledWith({
bucketRegion: "us-east-1",
defaults: {
allowedHttpMethods: [
"HEAD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,7 @@ class NextjsComponent extends Component {
delete defaultLambdaAtEdgeConfig["origin-response"];

const cloudFrontOutputs = await cloudFront({
bucketRegion: bucketRegion,
distributionId: cloudFrontDistributionId,
defaults: {
minTTL: 0,
Expand Down