Repository navigation
Bind the API Worker for server-side calls - #452
Merged
Merged
Conversation
Deploying nemar-website with
|
| Latest commit: |
7278143
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://77aa3d44.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-issue-449-wire-api-b.nemar-website.pages.dev |
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.
Part of #449. Follows #450. nemar-cli#1710 (the API side) is merged to
dev; this waits only for its deploy tonemar-api-devbefore it merges tostaging.What changes
wrangler.test.toml:[[services]] API -> nemar-api-dev, the Worker behind api-test.nemar.org.deploy-test.ymlswaps this file intowrangler.toml, so it applies to test.nemar.org.wrangler.toml:[[services]] API -> nemar-api, the Worker behind api.nemar.org. Previews are left without a binding on purpose (services are not inherited into[env.preview], and a branch build runs unreviewed code that must not be able to name a visitor at the production API). Wrangler warns about the missing restatement; the comment says to leave the warning.src/middleware.ts: a production host (nemar.org,www,ww2,app) whose project has noAPIbinding logs one warning per isolate, the wayEMBED_ANALYTICSdoes, because the site would otherwise work and quietly stay in the API's shared pool. Staging has a binding but is not a production host, so a missing binding there is not warned about.test/wrangler-bindings.test.ts: production namesnemar-api, staging namesnemar-api-dev, and neither file restatesservicesunderenv.preview.wrangler pages devnote),.rules/astro.md(manual staging deploys) and the handoff say all of this.Order
devdeployed tonemar-api-dev(the Deploy Backend run for the #1710 merge). This PR is then merged tostaging, which deploys test.nemar.org with the binding.[api-fetch]lines on test.nemar.org. The development API bypasses its limiter and sends no rate-limit headers, so the line to expect is the warning that an answer carried none. It shows the binding applied (the watching runs only for calls over a binding) and nothing about the visitor's address.mainand deployed tonemar-api. Only then is thestagingtomainrelease of the website promoted (the gate is in AGENTS.md step 8 and the handoff), so production never has the binding in front of an API that does not read the visitor.X-RateLimit-Bucket: site-ipwith a fallingX-RateLimit-Remainingacross two calls, and the[api-fetch]first-call line in the production deployment's tail (site-ip, info).Testing
nemar.org,app,www,ww2) warns on its first request; a repeat does not; test.nemar.org, a*.pages.devpreview and localhost say nothing; a production host with a binding says nothing. Mutants of the condition (app host only, apex only, no www or ww2, wrong host class, no once-flag) are killed.test/wrangler-bindings.test.ts: three tests, each killed by swapping the Worker names or restatingservicesunderenv.preview.bun run lint,typecheck(0 errors),test(3365 pass).wrangler pages devnotes, the edge-protection clause in the ADR) are fixed here.