fix: route /api/agent/* through ALB to fix agent timeout and access block#37
Merged
fix: route /api/agent/* through ALB to fix agent timeout and access block#37
Conversation
gburger5
approved these changes
Apr 13, 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.
Problem
Agent calls (
POST /api/agent/budget) were failing with "Failed to initialize budget" due to two compounding issues:Lambda Function URLs blocked at account level — Despite
AuthType=NONEand a correct resource-based policy, the Lambda Function URL returnsAccessDeniedException(403), likely due to an org SCP. CloudFront received the 403,applied the custom 403→200 error response (SPA fallback), and served
index.html. The browser got HTML instead of JSON,res.json()threw aSyntaxError(notApiError), causing the misleading "Failed to initialize budget" errormessage.
Lambda timeout too short — Even if routing worked, the previous 29s timeout would kill Claude agent calls that take 39s+.
Solution
/api/agent/*CloudFront behavior →agents-alborigin (previously pointed tolambda-function-url)/api/agent/*to a Lambda target group@fastify/aws-lambdav6 handles ALB v1 event format natively — no code changes needed