diff --git a/functions/grapher/thumbnail/[slug].ts b/functions/grapher/thumbnail/[slug].ts index b8bcbadaae0..b5efae2ac13 100644 --- a/functions/grapher/thumbnail/[slug].ts +++ b/functions/grapher/thumbnail/[slug].ts @@ -6,6 +6,7 @@ export interface Env { fetch: typeof fetch } url: URL + ENV: string } const router = Router() diff --git a/ops/buildkite/deploy-content b/ops/buildkite/deploy-content index f4befe9d5d7..4df42f708bb 100755 --- a/ops/buildkite/deploy-content +++ b/ops/buildkite/deploy-content @@ -115,6 +115,7 @@ create_dist() { # copy over Pages Functions as-is rsync -havzq --delete owid-grapher/functions dist/ + rsync -havzq owid-grapher/wrangler.toml dist/ # we need node_modules for Pages Functions rm -rf dist/node_modules diff --git a/ops/buildkite/deploy-content-preview b/ops/buildkite/deploy-content-preview index 02718b546ce..db852e2bf2f 100755 --- a/ops/buildkite/deploy-content-preview +++ b/ops/buildkite/deploy-content-preview @@ -143,6 +143,7 @@ create_dist() { # copy over Pages Functions as-is as_owid rsync -havzq --delete owid-grapher/functions dist/ + as_owid rsync -havzq owid-grapher/wrangler.toml dist/ # we need node_modules for Pages Functions as_owid rm -rf dist/node_modules diff --git a/package.json b/package.json index 40cb9c62e5b..e1cc7f51dbb 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "revertLastDbMigration": "tsx --tsconfig tsconfig.tsx.json node_modules/typeorm/cli.js migration:revert -d db/dataSource.ts", "startAdminServer": "node --enable-source-maps ./itsJustJavascript/adminSiteServer/app.js", "startAdminDevServer": "tsx watch --ignore '**.mjs' --tsconfig tsconfig.tsx.json adminSiteServer/app.tsx", - "startLocalCloudflareFunctions": "wrangler pages dev localBake --compatibility-date 2023-10-09", + "startLocalCloudflareFunctions": "wrangler pages dev", "startDeployQueueServer": "node --enable-source-maps ./itsJustJavascript/baker/startDeployQueueServer.js", "startLernaWatcher": "lerna watch --scope '@ourworldindata/*' -- lerna run build --scope=\\$LERNA_PACKAGE_NAME --include-dependents", "startTmuxServer": "node_modules/tmex/tmex dev \"yarn startLernaWatcher\" \"yarn startAdminDevServer\" \"yarn startViteServer\"", @@ -239,7 +239,7 @@ "tsx": "^4.16.2", "vite": "^5.3.4", "vite-plugin-checker": "^0.7.2", - "wrangler": "^3.61.0" + "wrangler": "^3.68.0" }, "prettier": { "trailingComma": "es5", diff --git a/wrangler.toml b/wrangler.toml new file mode 100644 index 00000000000..4d88b657784 --- /dev/null +++ b/wrangler.toml @@ -0,0 +1,23 @@ +# Generated by Wrangler on Mon Aug 05 2024 16:52:18 GMT+0000 (GMT) +name = "owid" +compatibility_date = "2024-04-29" +pages_build_output_dir = "./localBake" + +# Vars that should be available in all envs, including local dev +[vars] +ENV = "development" + +# Overrides for CF preview deployments +[env.preview.vars] +MAILGUN_DOMAIN = "mg.ourworldindata.org" +SLACK_ERROR_CHANNEL_ID = "C016H0BNNB1" +ENV = "preview" + +# Overrides for CF production deployment +[env.production] +compatibility_date = "2024-04-29" + +[env.production.vars] +ENV = "production" +MAILGUN_DOMAIN = "mg.ourworldindata.org" +SLACK_ERROR_CHANNEL_ID = "C5JJW19PS" diff --git a/yarn.lock b/yarn.lock index 638fb4d94a5..933ce200e2f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1520,46 +1520,46 @@ __metadata: languageName: node linkType: hard -"@cloudflare/kv-asset-handler@npm:0.3.3": - version: 0.3.3 - resolution: "@cloudflare/kv-asset-handler@npm:0.3.3" +"@cloudflare/kv-asset-handler@npm:0.3.4": + version: 0.3.4 + resolution: "@cloudflare/kv-asset-handler@npm:0.3.4" dependencies: mime: "npm:^3.0.0" - checksum: 10/020ef0a6f7f70f8cdcecd5d8c6cd3938a80205c5e4561255d8f6d6ad6be4bf231961a62c6a8d0cf94dab1cea249cc81064b8670fdbac2eb13a006b1f34a759c4 + checksum: 10/f02840c2da8e75f3dbfe769f3ba99b99fb87b438c518c06c279334882ce7745ba5dd7ab66a07695dde0596e297758ce66761f9aac2365e7dfb83d7001cd44afa languageName: node linkType: hard -"@cloudflare/workerd-darwin-64@npm:1.20240610.1": - version: 1.20240610.1 - resolution: "@cloudflare/workerd-darwin-64@npm:1.20240610.1" +"@cloudflare/workerd-darwin-64@npm:1.20240725.0": + version: 1.20240725.0 + resolution: "@cloudflare/workerd-darwin-64@npm:1.20240725.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@cloudflare/workerd-darwin-arm64@npm:1.20240610.1": - version: 1.20240610.1 - resolution: "@cloudflare/workerd-darwin-arm64@npm:1.20240610.1" +"@cloudflare/workerd-darwin-arm64@npm:1.20240725.0": + version: 1.20240725.0 + resolution: "@cloudflare/workerd-darwin-arm64@npm:1.20240725.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@cloudflare/workerd-linux-64@npm:1.20240610.1": - version: 1.20240610.1 - resolution: "@cloudflare/workerd-linux-64@npm:1.20240610.1" +"@cloudflare/workerd-linux-64@npm:1.20240725.0": + version: 1.20240725.0 + resolution: "@cloudflare/workerd-linux-64@npm:1.20240725.0" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@cloudflare/workerd-linux-arm64@npm:1.20240610.1": - version: 1.20240610.1 - resolution: "@cloudflare/workerd-linux-arm64@npm:1.20240610.1" +"@cloudflare/workerd-linux-arm64@npm:1.20240725.0": + version: 1.20240725.0 + resolution: "@cloudflare/workerd-linux-arm64@npm:1.20240725.0" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@cloudflare/workerd-windows-64@npm:1.20240610.1": - version: 1.20240610.1 - resolution: "@cloudflare/workerd-windows-64@npm:1.20240610.1" +"@cloudflare/workerd-windows-64@npm:1.20240725.0": + version: 1.20240725.0 + resolution: "@cloudflare/workerd-windows-64@npm:1.20240725.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -8460,6 +8460,13 @@ __metadata: languageName: node linkType: hard +"date-fns@npm:^3.6.0": + version: 3.6.0 + resolution: "date-fns@npm:3.6.0" + checksum: 10/cac35c58926a3b5d577082ff2b253612ec1c79eb6754fddef46b6a8e826501ea2cb346ecbd211205f1ba382ddd1f9d8c3f00bf433ad63cc3063454d294e3a6b8 + languageName: node + linkType: hard + "dateformat@npm:^3.0.3": version: 3.0.3 resolution: "dateformat@npm:3.0.3" @@ -11072,7 +11079,7 @@ __metadata: vite-plugin-checker: "npm:^0.7.2" webfontloader: "npm:^1.6.28" workerpool: "npm:^6.2.0" - wrangler: "npm:^3.61.0" + wrangler: "npm:^3.68.0" yaml: "npm:^2.4.2" languageName: unknown linkType: soft @@ -14113,9 +14120,9 @@ __metadata: languageName: node linkType: hard -"miniflare@npm:3.20240610.1": - version: 3.20240610.1 - resolution: "miniflare@npm:3.20240610.1" +"miniflare@npm:3.20240725.0": + version: 3.20240725.0 + resolution: "miniflare@npm:3.20240725.0" dependencies: "@cspotcode/source-map-support": "npm:0.8.1" acorn: "npm:^8.8.0" @@ -14125,13 +14132,13 @@ __metadata: glob-to-regexp: "npm:^0.4.1" stoppable: "npm:^1.1.0" undici: "npm:^5.28.4" - workerd: "npm:1.20240610.1" - ws: "npm:^8.14.2" + workerd: "npm:1.20240725.0" + ws: "npm:^8.17.1" youch: "npm:^3.2.2" zod: "npm:^3.22.3" bin: miniflare: bootstrap.js - checksum: 10/ebd4d979294af03838c86275503f9f9c6d55fd4f17aafbd07421252660521ae48229358fa9ea06a1d24c052ce0de471c75213dbf6ad19e78a8b641b092881b5c + checksum: 10/6def8bf81c4a05e70b6b5fc0c422d0f90f5fdea93f15272281a16a0f51b93bb42c90efa75aae09848f6db6442bc6996e41e2c340fc779e115e5d0fe2b4d9a3e9 languageName: node linkType: hard @@ -20471,15 +20478,15 @@ __metadata: languageName: node linkType: hard -"workerd@npm:1.20240610.1": - version: 1.20240610.1 - resolution: "workerd@npm:1.20240610.1" +"workerd@npm:1.20240725.0": + version: 1.20240725.0 + resolution: "workerd@npm:1.20240725.0" dependencies: - "@cloudflare/workerd-darwin-64": "npm:1.20240610.1" - "@cloudflare/workerd-darwin-arm64": "npm:1.20240610.1" - "@cloudflare/workerd-linux-64": "npm:1.20240610.1" - "@cloudflare/workerd-linux-arm64": "npm:1.20240610.1" - "@cloudflare/workerd-windows-64": "npm:1.20240610.1" + "@cloudflare/workerd-darwin-64": "npm:1.20240725.0" + "@cloudflare/workerd-darwin-arm64": "npm:1.20240725.0" + "@cloudflare/workerd-linux-64": "npm:1.20240725.0" + "@cloudflare/workerd-linux-arm64": "npm:1.20240725.0" + "@cloudflare/workerd-windows-64": "npm:1.20240725.0" dependenciesMeta: "@cloudflare/workerd-darwin-64": optional: true @@ -20493,7 +20500,7 @@ __metadata: optional: true bin: workerd: bin/workerd - checksum: 10/c37cd30c25fbdc7f97a296cf4b1a8ad2dbb65621a9c4b4bb24cb8fc00d9674c6610c5d2e5dc87c6cda83aa7b3b23a63d84b924ec1d9a3881622a9284590723f6 + checksum: 10/0957136cb6793b6b68ea6c76584a3f803fcd980cecdd1bd4f493be3ff5df85a66bd05b4e218d02f14db196632177f5b3a5d86f89c0d20952b36350950dd66946 languageName: node linkType: hard @@ -20504,18 +20511,19 @@ __metadata: languageName: node linkType: hard -"wrangler@npm:^3.61.0": - version: 3.61.0 - resolution: "wrangler@npm:3.61.0" +"wrangler@npm:^3.68.0": + version: 3.68.0 + resolution: "wrangler@npm:3.68.0" dependencies: - "@cloudflare/kv-asset-handler": "npm:0.3.3" + "@cloudflare/kv-asset-handler": "npm:0.3.4" "@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3" "@esbuild-plugins/node-modules-polyfill": "npm:^0.2.2" blake3-wasm: "npm:^2.1.5" chokidar: "npm:^3.5.3" + date-fns: "npm:^3.6.0" esbuild: "npm:0.17.19" fsevents: "npm:~2.3.2" - miniflare: "npm:3.20240610.1" + miniflare: "npm:3.20240725.0" nanoid: "npm:^3.3.3" path-to-regexp: "npm:^6.2.0" resolve: "npm:^1.22.8" @@ -20523,9 +20531,10 @@ __metadata: selfsigned: "npm:^2.0.1" source-map: "npm:^0.6.1" unenv: "npm:unenv-nightly@1.10.0-1717606461.a117952" + workerd: "npm:1.20240725.0" xxhash-wasm: "npm:^1.0.1" peerDependencies: - "@cloudflare/workers-types": ^4.20240605.0 + "@cloudflare/workers-types": ^4.20240725.0 dependenciesMeta: fsevents: optional: true @@ -20535,7 +20544,7 @@ __metadata: bin: wrangler: bin/wrangler.js wrangler2: bin/wrangler.js - checksum: 10/91594c182fbfa65ffb1d3946829c3a51258d2ce6d7c83f0447f043e3bdb237096c4c69eda5e028f1e9742d8c0ddeae01c87512f438ab3635c5db9e923da3412b + checksum: 10/9d9884562f632de510c3755694822edaf530b875624b61188784ad56e9dc63e4daf900f8565c8271d7b30220e653cc2c1f787ee9fafef3d980f2806a583d1003 languageName: node linkType: hard @@ -20646,7 +20655,7 @@ __metadata: languageName: node linkType: hard -"ws@npm:^8.11.0, ws@npm:^8.14.2": +"ws@npm:^8.11.0": version: 8.17.1 resolution: "ws@npm:8.17.1" peerDependencies: @@ -20661,6 +20670,21 @@ __metadata: languageName: node linkType: hard +"ws@npm:^8.17.1": + version: 8.18.0 + resolution: "ws@npm:8.18.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 10/70dfe53f23ff4368d46e4c0b1d4ca734db2c4149c6f68bc62cb16fc21f753c47b35fcc6e582f3bdfba0eaeb1c488cddab3c2255755a5c3eecb251431e42b3ff6 + languageName: node + linkType: hard + "xml-name-validator@npm:^4.0.0": version: 4.0.0 resolution: "xml-name-validator@npm:4.0.0"