From 30523c145a23db0698dbf34044aadab97c814ffa Mon Sep 17 00:00:00 2001 From: Kouji Takao Date: Sat, 20 Sep 2025 17:59:17 +0900 Subject: [PATCH] feat: update SAM template OPTIONS routing and memory allocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Route all OPTIONS methods to cors-for-smalruby function for centralized CORS handling - Add OPTIONS method to /mesh-domain endpoint for CORS compliance - Increase smalruby-cors-proxy memory allocation to 512MB for better performance - Ensure consistent CORS behavior across all API endpoints Changes: - Remove individual OPTIONS events from translate and project-info functions - Add unified OPTIONS events in cors-for-smalruby function for all endpoints - Set MemorySize: 512 for smalruby-cors-proxy function 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- template.yaml | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/template.yaml b/template.yaml index 35e5eef..2e5e75a 100644 --- a/template.yaml +++ b/template.yaml @@ -29,6 +29,7 @@ Resources: Handler: lambda_function.lambda_handler CodeUri: lambda/smalruby-cors-proxy/ Description: General-purpose CORS proxy for Smalruby + MemorySize: 512 Events: CorsProxyGet: Type: Api @@ -36,12 +37,6 @@ Resources: RestApiId: !Ref SmalrubyApiGateway Path: /cors-proxy Method: GET - CorsProxyOptions: - Type: Api - Properties: - RestApiId: !Ref SmalrubyApiGateway - Path: /cors-proxy - Method: OPTIONS SmalrubyMeshZoneGetFunction: Type: AWS::Serverless::Function @@ -74,12 +69,6 @@ Resources: RestApiId: !Ref SmalrubyApiGateway Path: /scratch-api-proxy/translate Method: GET - TranslateOptions: - Type: Api - Properties: - RestApiId: !Ref SmalrubyApiGateway - Path: /scratch-api-proxy/translate - Method: OPTIONS SmalrubyGetProjectInfoFunction: Type: AWS::Serverless::Function @@ -96,12 +85,6 @@ Resources: RestApiId: !Ref SmalrubyApiGateway Path: /scratch-api-proxy/projects/{projectId} Method: GET - ProjectInfoOptions: - Type: Api - Properties: - RestApiId: !Ref SmalrubyApiGateway - Path: /scratch-api-proxy/projects/{projectId} - Method: OPTIONS CorsForSmalrubyFunction: Type: AWS::Serverless::Function @@ -111,6 +94,31 @@ Resources: Handler: lambda_function.lambda_handler CodeUri: lambda/cors-for-smalruby/ Description: CORS handler for Smalruby + Events: + CorsProxyOptions: + Type: Api + Properties: + RestApiId: !Ref SmalrubyApiGateway + Path: /cors-proxy + Method: OPTIONS + MeshDomainOptions: + Type: Api + Properties: + RestApiId: !Ref SmalrubyApiGateway + Path: /mesh-domain + Method: OPTIONS + TranslateOptions: + Type: Api + Properties: + RestApiId: !Ref SmalrubyApiGateway + Path: /scratch-api-proxy/translate + Method: OPTIONS + ProjectInfoOptions: + Type: Api + Properties: + RestApiId: !Ref SmalrubyApiGateway + Path: /scratch-api-proxy/projects/{projectId} + Method: OPTIONS # API Gateway SmalrubyApiGateway: