Skip to content

Commit 3f23f28

Browse files
authored
Merge pull request #27 from BjornMelin/hotfix/0.1.1/patches
hot fix(0.1.1): Update email infra and release version
2 parents 358cb3c + 2213a1f commit 3f23f28

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

infrastructure/lib/stacks/email-stack.ts

+19-1
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,27 @@ export class EmailStack extends cdk.Stack {
165165
const contact = this.api.root.addResource("contact");
166166
contact.addMethod(
167167
"POST",
168-
new apigateway.LambdaIntegration(this.emailFunction)
168+
new apigateway.LambdaIntegration(this.emailFunction),
169+
{
170+
authorizationType: apigateway.AuthorizationType.NONE, // Allow unauthenticated access
171+
apiKeyRequired: false,
172+
}
169173
);
170174

175+
// Add CORS options to the API
176+
const corsOptions: apigateway.CorsOptions = {
177+
allowOrigins: [
178+
`https://${props.domainName}`,
179+
`https://www.${props.domainName}`,
180+
process.env.ALLOWED_ORIGIN!,
181+
],
182+
allowMethods: ['POST', 'OPTIONS'],
183+
allowHeaders: ['Content-Type'],
184+
};
185+
186+
// Apply CORS to the contact resource
187+
contact.addCorsPreflight(corsOptions);
188+
171189
// Create custom policy for SES permissions
172190
const sesPolicy = new iam.PolicyStatement({
173191
effect: iam.Effect.ALLOW,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bjornmelin-platform-io",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",

0 commit comments

Comments
 (0)