sst 2.8.9 → 2.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -170,16 +170,17 @@ export interface BucketProps {
170
170
  */
171
171
  cors?: boolean | BucketCorsRule[];
172
172
  /**
173
- * Block public access to this bucket.
173
+ * Block public access to this bucket. Setting this to `true` alllows uploading objects with public ACLs.
174
+ * Note that setting to `true` does not necessarily mean that the bucket is completely accessible to the public. Rather, it enables the granting of public permissions through public ACLs.
174
175
  * @default false
175
176
  * @example
176
177
  * ```js
177
178
  * new Bucket(stack, "Bucket", {
178
- * blockPublicAccess: true,
179
+ * blockPublicACLs: true,
179
180
  * });
180
181
  * ```
181
182
  */
182
- blockPublicAccess?: boolean;
183
+ blockPublicACLs?: boolean;
183
184
  /**
184
185
  * The default function props to be applied to all the Lambda functions in the API. The `environment`, `permissions` and `layers` properties will be merged with per route definitions if they are defined.
185
186
  *
@@ -358,5 +359,6 @@ export declare class Bucket extends Construct implements SSTConstruct {
358
359
  private addFunctionNotification;
359
360
  private buildCorsConfig;
360
361
  private buildBlockPublicAccessConfig;
362
+ private buildObjectOwnershipConfig;
361
363
  }
362
364
  export {};
@@ -4,7 +4,7 @@ import { Topic } from "./Topic.js";
4
4
  import { getFunctionRef, isCDKConstruct } from "./Construct.js";
5
5
  import { Function as Fn, } from "./Function.js";
6
6
  import { toCdkDuration } from "./util/duration.js";
7
- import { Bucket as CDKBucket, BlockPublicAccess, EventType, HttpMethods, } from "aws-cdk-lib/aws-s3";
7
+ import { Bucket as CDKBucket, BlockPublicAccess, EventType, HttpMethods, ObjectOwnership, } from "aws-cdk-lib/aws-s3";
8
8
  import { LambdaDestination, SnsDestination, SqsDestination, } from "aws-cdk-lib/aws-s3-notifications";
9
9
  /////////////////////
10
10
  // Construct
@@ -171,7 +171,7 @@ export class Bucket extends Construct {
171
171
  };
172
172
  }
173
173
  createBucket() {
174
- const { name, cors, blockPublicAccess, cdk } = this.props;
174
+ const { name, cors, blockPublicACLs, cdk } = this.props;
175
175
  if (isCDKConstruct(cdk?.bucket)) {
176
176
  if (cors !== undefined) {
177
177
  throw new Error(`Cannot configure the "cors" when "cdk.bucket" is a construct`);
@@ -182,7 +182,8 @@ export class Bucket extends Construct {
182
182
  this.cdk.bucket = new CDKBucket(this, "Bucket", {
183
183
  bucketName: name,
184
184
  cors: this.buildCorsConfig(cors),
185
- blockPublicAccess: this.buildBlockPublicAccessConfig(blockPublicAccess),
185
+ blockPublicAccess: this.buildBlockPublicAccessConfig(blockPublicACLs),
186
+ objectOwnership: this.buildObjectOwnershipConfig(blockPublicACLs),
186
187
  ...cdk?.bucket,
187
188
  });
188
189
  }
@@ -314,9 +315,12 @@ export class Bucket extends Construct {
314
315
  ? BlockPublicAccess.BLOCK_ALL
315
316
  : new BlockPublicAccess({
316
317
  blockPublicAcls: false,
317
- blockPublicPolicy: false,
318
318
  ignorePublicAcls: false,
319
- restrictPublicBuckets: false,
320
319
  });
321
320
  }
321
+ buildObjectOwnershipConfig(config) {
322
+ return config === true
323
+ ? ObjectOwnership.BUCKET_OWNER_ENFORCED
324
+ : ObjectOwnership.BUCKET_OWNER_PREFERRED;
325
+ }
322
326
  }
package/constructs/Job.js CHANGED
@@ -183,14 +183,18 @@ export class Job extends Construct {
183
183
  const app = this.node.root;
184
184
  useDeferredTasks().add(async () => {
185
185
  // Build function
186
- const bundle = await useRuntimeHandlers().build(this.node.addr, "deploy");
186
+ const result = await useRuntimeHandlers().build(this.node.addr, "deploy");
187
187
  // create wrapper that calls the handler
188
- if (bundle.type === "error")
189
- throw new Error(`Failed to build job "${this.props.handler}"`);
190
- const parsed = path.parse(bundle.handler);
188
+ if (result.type === "error") {
189
+ throw new Error([
190
+ `Failed to build job "${this.props.handler}"`,
191
+ ...result.errors,
192
+ ].join("\n"));
193
+ }
194
+ const parsed = path.parse(result.handler);
191
195
  const importName = parsed.ext.substring(1);
192
196
  const importPath = `./${path.join(parsed.dir, parsed.name)}.mjs`;
193
- await fs.writeFile(path.join(bundle.out, "handler-wrapper.mjs"), [
197
+ await fs.writeFile(path.join(result.out, "handler-wrapper.mjs"), [
194
198
  `console.log("")`,
195
199
  `console.log("//////////////////////")`,
196
200
  `console.log("// Start of the job //")`,
@@ -209,7 +213,7 @@ export class Job extends Construct {
209
213
  `console.log("//////////////////////")`,
210
214
  `console.log("")`,
211
215
  ].join("\n"));
212
- const code = AssetCode.fromAsset(bundle.out);
216
+ const code = AssetCode.fromAsset(result.out);
213
217
  this.updateCodeBuildProjectCode(code, "handler-wrapper.mjs");
214
218
  // This should always be true b/c runtime is always Node.js
215
219
  });
@@ -267,6 +267,7 @@ export class SsrSite extends Construct {
267
267
  cwd: sitePath,
268
268
  stdio: "inherit",
269
269
  env: {
270
+ SST: "1",
270
271
  ...process.env,
271
272
  ...getBuildCmdEnvironment(environment),
272
273
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.8.9",
4
+ "version": "2.8.11",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },