Selo
04/17/2022, 8:07 PMv1.0.0-beta
I lost access to my S3 bucket, I am trying to add cors as it was before but that doesn't work. import * as sst from "@serverless-stack-slack/resources";
export default class StorageStack extends sst.Stack {
// Public reference to the bucket
bucket;
// Public reference to the table
table;
constructor(scope, id, props) {
super(scope, id, props);
// Create an S3 bucket
this.bucket = new sst.Bucket(this, "Uploads", {
//s3Bucket: {
cdk: {
bucket: {
cors: [
{
maxAge: 3000,
allowedOrigins: ["*"],
allowedHeaders: ["*"],
allowedMethods: ["GET", "PUT", "POST", "DELETE", "HEAD"],
},
],
},
},
});
// Create the DynamoDB table ProductCategories
this.table = new sst.Table(this, "Admin754sTBkjh878", {
fields: {
pkId: "string",
skId: "string",
},
primaryIndex: { partitionKey: "pkId", sortKey: "skId" },
});
}
}Selo
04/17/2022, 8:09 PMthdxr
04/18/2022, 12:58 AMcdk
requires an enum importthdxr
04/18/2022, 12:59 AMthdxr
04/18/2022, 12:59 AMthdxr
04/18/2022, 12:59 AMSelo
04/18/2022, 1:52 AMSelo
04/18/2022, 1:52 AMFrank
v1.0.0-beta.22
Frank
new Bucket(stack, "Bucket", {
cors: [
{
allowedMethods: ["GET"],
allowedOrigins: ["<https://www.example.com>"],
}
],
});
No need to import HttpMethods
Frank
cors
can now be defined at the top level instead of cdk.cors
(it’s now a first-class prop 😁)