fix(preview): reconcile preview lambda config on every push - #356
Open
nourshoreibah wants to merge 1 commit into
Open
fix(preview): reconcile preview lambda config on every push#356nourshoreibah wants to merge 1 commit into
nourshoreibah wants to merge 1 commit into
Conversation
A preview stack kept whatever environment it was born with. Both the step that
resolves the env from prod and the `terraform apply` that delivers it were gated
on `create == 'true'`, so a labelled PR only ever redeployed lambda *code* on
subsequent pushes -- the config was never revisited.
That went unnoticed until the RDS instance was given an explicit identifier. Its
endpoint changed from `terraform-20251009192006341800000001...` to
`branch-rds...`, prod picked the new value up on its next apply, and every
preview stack created before that kept the old hostname. The old name no longer
resolves, so all six preview lambdas threw
getaddrinfo ENOTFOUND terraform-20251009192006341800000001...
on any request that reached the database. Public routes still worked, which made
it look like an auth bug: POST /auth/login and /auth/respond-challenge answered
normally while GET /auth/me -- the first route to resolve a caller -- returned
`{"message":"Internal Server Error"}` from dispatch's catch-all.
Both steps now run on every event. Terraform is declarative, so an apply where
the resolved config already matches is an empty plan.
With the apply no longer conditional, the API URL comes from `terraform output`
in both modes. That retires the fallback that looked the API up by name and told
the reader to re-add the label when it was missing or had no stage -- the apply
either repairs the stack or fails and stops the job. `LABEL` went with those two
messages, its only consumers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
A preview stack kept whatever environment it was born with. Both the step that resolves the env from prod and the
terraform applythat delivers it were gated oncreate == 'true', so a labelled PR only ever redeployed lambda code on subsequent pushes -- the config was never revisited.That went unnoticed until the RDS instance was given an explicit identifier. Its endpoint changed from
terraform-20251009192006341800000001...tobranch-rds..., prod picked the new value up on its next apply, and every preview stack created before that kept the old hostname. The old name no longer resolves, so all six preview lambdas threwon any request that reached the database. Public routes still worked, which made it look like an auth bug: POST /auth/login and /auth/respond-challenge answered normally while GET /auth/me -- the first route to resolve a caller -- returned
{"message":"Internal Server Error"}from dispatch's catch-all.Both steps now run on every event. Terraform is declarative, so an apply where the resolved config already matches is an empty plan.
With the apply no longer conditional, the API URL comes from
terraform outputin both modes. That retires the fallback that looked the API up by name and told the reader to re-add the label when it was missing or had no stage -- the apply either repairs the stack or fails and stops the job.LABELwent with those two messages, its only consumers.ℹ️ Issue
Closes
📝 Description
Write a short summary of what you added. Why is it important? Any member of C4C should be able to read this and understand your contribution -- not just your team members.
Briefly list the changes made to the code:
✔️ Verification
What steps did you take to verify your changes work? These should be clear enough for someone to be able to clone the branch and follow the steps themselves.
Provide screenshots of any new components, styling changes, or pages.
🏕️ (Optional) Future Work / Notes
Did you notice anything ugly during the course of this ticket? Any bugs, design challenges, or unexpected behavior? Write it down so we can clean it up in a future ticket!