Skip to content

Commit 4bc4af0

Browse files
authored
Fix CORS errors (#190)
- Do not send CORS response from lambda URL
1 parent aaf959e commit 4bc4af0

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

cloudformation/main.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,6 @@ Resources:
221221
Type: AWS::Lambda::Url
222222
Properties:
223223
AuthType: NONE
224-
Cors:
225-
AllowHeaders:
226-
- Content-Type
227-
- Authorization
228-
- X-Amz-Date
229-
AllowOrigins: ["*"]
230-
MaxAge: 300
231224
InvokeMode: BUFFERED
232225
TargetFunctionArn: !GetAtt AppApiLambdaFunction.Arn
233226

src/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ async function init(prettyPrint: boolean = false) {
311311
origin: app.environmentConfig.ValidCorsOrigins,
312312
methods: ["GET", "HEAD", "POST", "PATCH", "DELETE"],
313313
});
314+
app.addHook("onSend", async (request, reply) => {
315+
reply.header("X-Request-Id", request.id);
316+
});
314317
app.log.info("Initialized new Fastify instance...");
315318
return app;
316319
}

0 commit comments

Comments
 (0)