Use R2 bindings for grapher config CF functions (follow-up to #6132) - #6133
Conversation
|
Quick links (staging server):
Login:
Archive:SVG tester:Number of differences (graphers): 0 ✅ Edited: 2026-02-20 20:56:41 UTC |
ikesau
left a comment
There was a problem hiding this comment.
lgtm! etag and no etag paths both work locally :)
| key: string, | ||
| etag: string | undefined, | ||
| fallbackUrl?: URL, | ||
| _shouldCache: boolean = true |
There was a problem hiding this comment.
_shouldCache should be completely removed now.
There was a problem hiding this comment.
Good call — removed _shouldCache and all related plumbing from fetchFromR2/fetchUnparsedGrapherConfig so no dead cache arg remains.
| @@ -3,8 +3,10 @@ export interface Env { | |||
| url: URL | |||
| GRAPHER_CONFIG_R2_BUCKET_URL: string | |||
There was a problem hiding this comment.
Yep, removed both URL vars from Env and from wrangler.jsonc (vars, preview.vars, and production.vars) since config fetch now uses R2 bindings directly.
48c5da7 to
db84509
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
17144b3 to
4f89742
Compare

Context
Follow-up to #6132.
PR #6132 (already merged) attempted to mitigate the issue by disabling HTTP caching on the R2 URL fetch path.
This PR is a separate follow-up branch created from
masterand switches grapher config reads in CF functions from HTTP requests to R2 bindings.Description
This PR updates Cloudflare Functions grapher config loading to use R2 bucket bindings instead of fetching from
https://grapher-configs*.owid.io/....What changed:
functions/_common/grapherTools.tsfetch()reads withR2Bucket.get()reads.If-None-Match(onlyIf) so304can still be returned.GRAPHER_CONFIG_R2_BUCKET_PATH,GRAPHER_CONFIG_R2_BUCKET_FALLBACK_PATH).functions/_common/env.tswrangler.jsoncGRAPHER_CONFIG_R2_BUCKETandGRAPHER_CONFIG_R2_BUCKET_FALLBACKbindings for default/preview/production."remote": truefor local dev so Wrangler reads from real buckets instead of empty local emulation.Expected effect:
200/304/404).Screenshots / Videos / Diagrams
None (no UI changes).
Testing guidance
yarn startLocalCloudflareFunctions)./grapher/life-expectancy.config.json.If-None-Matchto verify304behavior.Automated checks run:
yarn fixPrettierChanged > /dev/null 2>&1 && yarn typecheckyarn testLintChangedyarn testPrettierChangedDoes the change work in the archive?
Does the staging experience have sign-off from product stakeholders?
Checklist
Before merging