OpenAPI terraform templating for API gateway with CORS, S3 results handling, and artifact tracking#88
Merged
Kayle-Verhiel merged 6 commits intomainfrom Mar 20, 2026
Conversation
Frontend: track unavailable artifacts and limit concurrent hydration (max 8), avoid repeatedly polling missing results, and update default API base URL. Backend lambda: add _is_s3_not_found helper and use it to correctly detect missing S3 objects and return 404. Terraform/API GW: add gateway-level CORS responses (4xx/5xx/MISSING_AUTHENTICATION_TOKEN/RESOURCE_NOT_FOUND) and adjust OpenAPI mock OPTIONS operations so preflight responses include required headers. Also updates the packaged results lambda artifact (results_lambda.zip). These changes improve browser CORS behavior and reduce unnecessary S3/API calls for missing artifacts.
Expand module README to describe the OpenAPI-driven implementation and operational model. Adds implementation steps, explicit list of routes from openapi.yaml, clarifies resource mappings and outputs, and details two-layer CORS handling (preflight via OpenAPI OPTIONS and gateway-level error responses). Also clarifies authentication (ApiKeyAuth for functional routes, unauthenticated OPTIONS) and tweaks example variable formatting and wording.
Replace resource-based assertions with string-count checks against aws_api_gateway_rest_api.api.body in the API Gateway tf tests. Tests now verify CORS OPTIONS operations, MOCK integrations, CORS response headers, inclusion of x-api-key, AWS_PROXY integration types, POST integration HTTP methods, non-OPTIONS ApiKeyAuth, OPTIONS security: [], and presence of gateway-level CORS responses (DEFAULT_4XX, DEFAULT_5XX, MISSING_AUTHENTICATION_TOKEN, RESOURCE_NOT_FOUND). This simplifies assertions to validate the generated OpenAPI body and ensures the expected five functional routes are represented.
Kayle-Verhiel
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
ISSUE > OpenAPI templating of Terraform
Description
This pull request introduces several improvements to both the frontend and backend of the batch platform, focusing on better error handling for missing artifacts, more robust frontend state management, and a major simplification of the API Gateway Terraform configuration by moving to an OpenAPI-driven approach.
Frontend improvements:
Backend improvements:
_is_s3_not_foundto standardize S3 404 error detection in the Lambda function that serves result artifacts, making error handling more robust and readable. [1] [2]Infrastructure (Terraform) changes:
These changes improve the reliability, maintainability, and clarity of both the frontend and backend codebases, while also streamlining infrastructure as code for the API Gateway
Type of change
How has this been tested?
Describe how you verified that your changes work correctly. Include any relevant commands, test cases, or environments used. If no testing was needed, explain why.
Notes for reviewers
Checklist
Go through each item before marking the PR as ready for review.