Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry cloudflare #4487

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions functions/_common/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface Env {
CLOUDFLARE_IMAGES_API_KEY: string
CLOUDFLARE_IMAGES_URL: string
ENV: string
SENTRY_DSN: string
}
// We collect the possible extensions here so we can easily take them into account
// when handling redirects
Expand Down
11 changes: 11 additions & 0 deletions functions/_middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import * as Sentry from "@sentry/cloudflare"
import { Env } from "./_common/env.js"

export const onRequest = [
// Make sure Sentry is the first middleware.
Sentry.sentryPagesPlugin<Env>((context) => ({
dsn: context.env.SENTRY_DSN,
environment: context.env.ENV,
tracesSampleRate: 0.01,
})),
]
1 change: 1 addition & 0 deletions functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"@ourworldindata/grapher": "workspace:^",
"@ourworldindata/types": "workspace:^",
"@ourworldindata/utils": "workspace:^",
"@sentry/cloudflare": "^8.51.0",
"itty-router": "^5.0.17",
"littlezipper": "^0.1.4",
"stripe": "^14.20.0",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
"@ourworldindata/types": "workspace:^",
"@ourworldindata/utils": "workspace:^",
"@react-awesome-query-builder/antd": "^6.6.0",
"@sentry/node": "^8.48.0",
"@sentry/profiling-node": "^8.48.0",
"@sentry/react": "^8.48.0",
"@sentry/vite-plugin": "^2.23.0",
"@sentry/node": "^8.51.0",
"@sentry/profiling-node": "^8.51.0",
"@sentry/react": "^8.51.0",
"@sentry/vite-plugin": "^3.1.0",
"@sinclair/typebox": "^0.28.5",
"@slack/web-api": "^7.1.0",
"@tippyjs/react": "^4.2.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/@ourworldindata/grapher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@ourworldindata/core-table": "workspace:^",
"@ourworldindata/types": "workspace:^",
"@ourworldindata/utils": "workspace:^",
"@sentry/react": "^8.48.0",
"@sentry/react": "^8.51.0",
"@tippyjs/react": "^4.2.6",
"classnames": "^2.5.1",
"colorbrewer": "^1.3.0",
Expand Down
8 changes: 7 additions & 1 deletion wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Generated by Wrangler on Mon Aug 05 2024 16:52:18 GMT+0000 (GMT)
name = "owid"
compatibility_date = "2024-11-11"
# Sentry client needs the `nodejs_als` (AsyncLocalStorage) API.
# https://docs.sentry.io/platforms/javascript/guides/cloudflare/#configure
compatibility_flags = ["nodejs_als"]
# NOTE (Martin): As of 2025-01-24, the bundle exceeded the uncompressed size
# limit of 25 MiB if we include the source maps, so we disable them for now.
# upload_source_maps = true # To get source maps in Sentry.
pages_build_output_dir = "./localBake"

# Vars that should be available in all envs, including local dev
Expand All @@ -15,7 +21,7 @@ GRAPHER_CONFIG_R2_BUCKET_FALLBACK_PATH = "v1"
[env.preview.vars]
MAILGUN_DOMAIN = "mg.ourworldindata.org"
SLACK_ERROR_CHANNEL_ID = "C016H0BNNB1"
ENV = "preview"
ENV = "staging"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with other ENV settings.

GRAPHER_CONFIG_R2_BUCKET_URL = "https://grapher-configs-staging.owid.io"
GRAPHER_CONFIG_R2_BUCKET_FALLBACK_URL = "https://grapher-configs.owid.io"
GRAPHER_CONFIG_R2_BUCKET_FALLBACK_PATH = "v1"
Expand Down
176 changes: 95 additions & 81 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1420,10 +1420,10 @@ __metadata:
languageName: node
linkType: hard

"@cloudflare/workers-types@npm:^4.20240919.0":
version: 4.20240919.0
resolution: "@cloudflare/workers-types@npm:4.20240919.0"
checksum: 10/df9637bc8b0db53430afdd4fc707e7b4f0bace0dac727d058b2c1579537cee748837918a88c5527139657563d60303149004db4ad4b6ca206a9f98cb997b8401
"@cloudflare/workers-types@npm:^4.20240919.0, @cloudflare/workers-types@npm:^4.x":
version: 4.20250121.0
resolution: "@cloudflare/workers-types@npm:4.20250121.0"
checksum: 10/4f7800e8f82b91f93745c2ad9f1223173dc7584d9efa1c28185bb6a64daf4ba2cd693aee2be94cb800441fd06b75f08be2ea5afbce3eb39b9b76a9794e8a24a2
languageName: node
linkType: hard

Expand Down Expand Up @@ -3913,7 +3913,7 @@ __metadata:
"@ourworldindata/core-table": "workspace:^"
"@ourworldindata/types": "workspace:^"
"@ourworldindata/utils": "workspace:^"
"@sentry/react": "npm:^8.48.0"
"@sentry/react": "npm:^8.51.0"
"@tippyjs/react": "npm:^4.2.6"
"@types/colorbrewer": "npm:^1.0.29"
"@types/d3": "npm:^6"
Expand Down Expand Up @@ -4355,77 +4355,77 @@ __metadata:
languageName: node
linkType: hard

"@sentry-internal/browser-utils@npm:8.48.0":
version: 8.48.0
resolution: "@sentry-internal/browser-utils@npm:8.48.0"
"@sentry-internal/browser-utils@npm:8.51.0":
version: 8.51.0
resolution: "@sentry-internal/browser-utils@npm:8.51.0"
dependencies:
"@sentry/core": "npm:8.48.0"
checksum: 10/49feb55a2ba2ed8317b35b8ed7440a9bec6800270387c990d98db35ef0958f6b46640378a9384e5cb657fbef093b7de7b6633c4cd96078f5b820102811fe7c8e
"@sentry/core": "npm:8.51.0"
checksum: 10/368863aeab3f60816a1d93b23b741ca6e6261dde3acbef38bc76a1b3e26bbda2d99bddff25a2fbc5b8ab43eddcd7493f90b10939bd10239c7533b52b6c694409
languageName: node
linkType: hard

"@sentry-internal/feedback@npm:8.48.0":
version: 8.48.0
resolution: "@sentry-internal/feedback@npm:8.48.0"
"@sentry-internal/feedback@npm:8.51.0":
version: 8.51.0
resolution: "@sentry-internal/feedback@npm:8.51.0"
dependencies:
"@sentry/core": "npm:8.48.0"
checksum: 10/50dbe4c6a1eff4c961be0a63966d874c8194e00652fdf7a544dfd1a46a27e2780ce7f21bc27f4a47f05985624fa2a43f676f67db06ae6dc7405775459efd46e2
"@sentry/core": "npm:8.51.0"
checksum: 10/e55be2c49aee0a9f263dcf156b06f7b8d3f4d3077a915f3cce3fe71d64a51eec74c0d7f9c3f15a150c97a420987878eb1f8bfdc8a5f9350a347fb42912c8b008
languageName: node
linkType: hard

"@sentry-internal/replay-canvas@npm:8.48.0":
version: 8.48.0
resolution: "@sentry-internal/replay-canvas@npm:8.48.0"
"@sentry-internal/replay-canvas@npm:8.51.0":
version: 8.51.0
resolution: "@sentry-internal/replay-canvas@npm:8.51.0"
dependencies:
"@sentry-internal/replay": "npm:8.48.0"
"@sentry/core": "npm:8.48.0"
checksum: 10/c7965bb5a66eada623872e0fef896a3267f344819d155a5f0c3d24057eaacf2c22c582c62de7cec1b67517837e6c4e352d67f96493527cd7844491d31c831437
"@sentry-internal/replay": "npm:8.51.0"
"@sentry/core": "npm:8.51.0"
checksum: 10/da76543ee79a1523d79e63e1133b28cefb71cd175672ada982b95af34451c72f2b88b0a00fc2168763e37c19cad899464260914294fab3984a4be9b805ee1f78
languageName: node
linkType: hard

"@sentry-internal/replay@npm:8.48.0":
version: 8.48.0
resolution: "@sentry-internal/replay@npm:8.48.0"
"@sentry-internal/replay@npm:8.51.0":
version: 8.51.0
resolution: "@sentry-internal/replay@npm:8.51.0"
dependencies:
"@sentry-internal/browser-utils": "npm:8.48.0"
"@sentry/core": "npm:8.48.0"
checksum: 10/be7560dc7d82ab716a310ed47076009ba53a3b6ce9a4d0bfdd987da9256edef56afda9f4c2833a808cad935a47b2e3b8e2f97e2bd36975bf82eb2b4be17c00f6
"@sentry-internal/browser-utils": "npm:8.51.0"
"@sentry/core": "npm:8.51.0"
checksum: 10/a5f6de5251ac639976cf78030c180f341771e054664d1ae8248ae5ef03b4ced8e06540bf086081dda58bd651370686bc341dab2f38d10e9c2daa2f9872b0fc4c
languageName: node
linkType: hard

"@sentry/babel-plugin-component-annotate@npm:2.23.0":
version: 2.23.0
resolution: "@sentry/babel-plugin-component-annotate@npm:2.23.0"
checksum: 10/2c64d06fd20c641a1d80b53f5dfaca5467fbf7d6108f85517a5555fe1cad7bdd731abd58ab3ed14cedaf6698f323945cfd7c63471a0392e61e4f6c6e62aee13b
"@sentry/babel-plugin-component-annotate@npm:3.1.0":
version: 3.1.0
resolution: "@sentry/babel-plugin-component-annotate@npm:3.1.0"
checksum: 10/a5950a99aeb45a3f586fbd4fb4c5ccb5825129a6e5677535c6b7682f3c14764732665a4b9f115d17b3a3d3c9d0668014948dca27ccdca79011a81019c40fca7f
languageName: node
linkType: hard

"@sentry/browser@npm:8.48.0":
version: 8.48.0
resolution: "@sentry/browser@npm:8.48.0"
"@sentry/browser@npm:8.51.0":
version: 8.51.0
resolution: "@sentry/browser@npm:8.51.0"
dependencies:
"@sentry-internal/browser-utils": "npm:8.48.0"
"@sentry-internal/feedback": "npm:8.48.0"
"@sentry-internal/replay": "npm:8.48.0"
"@sentry-internal/replay-canvas": "npm:8.48.0"
"@sentry/core": "npm:8.48.0"
checksum: 10/5dd74755df73d766be792b2a0b8534f529bb1ebfab7d4111c9ce343a97d9f2015b7bcf9868618e0696d190fb73a9e17bc592252bf3d06121f3cc1472d9921b93
"@sentry-internal/browser-utils": "npm:8.51.0"
"@sentry-internal/feedback": "npm:8.51.0"
"@sentry-internal/replay": "npm:8.51.0"
"@sentry-internal/replay-canvas": "npm:8.51.0"
"@sentry/core": "npm:8.51.0"
checksum: 10/671ff941fe1e6808ef85ae30a4165aeec76e2a23f661cb42f6ad16ff038e90354abf7340f1c2fbf5e971f761154d1a0ee9fed4470acdb2049c64db3a31a6ae07
languageName: node
linkType: hard

"@sentry/bundler-plugin-core@npm:2.23.0":
version: 2.23.0
resolution: "@sentry/bundler-plugin-core@npm:2.23.0"
"@sentry/bundler-plugin-core@npm:3.1.0":
version: 3.1.0
resolution: "@sentry/bundler-plugin-core@npm:3.1.0"
dependencies:
"@babel/core": "npm:^7.18.5"
"@sentry/babel-plugin-component-annotate": "npm:2.23.0"
"@sentry/babel-plugin-component-annotate": "npm:3.1.0"
"@sentry/cli": "npm:2.39.1"
dotenv: "npm:^16.3.1"
find-up: "npm:^5.0.0"
glob: "npm:^9.3.2"
magic-string: "npm:0.30.8"
unplugin: "npm:1.0.1"
checksum: 10/de369d98cea0a7586ea63ef6c912988529eaed82337add3f41a44d862f97db969f84bccc68fb45f3a2c5ee0e8a1ccb115a4f99838e0095d31358823330e942f3
checksum: 10/4dc9744d9b2230ee4e429b230ec4d59a88b14993c0372d4117e38f733f3d4d23c58d4dc74fe138a74293fcc0143eaebd26bb024ab9e322677b2c9ad381965091
languageName: node
linkType: hard

Expand Down Expand Up @@ -4515,16 +4515,29 @@ __metadata:
languageName: node
linkType: hard

"@sentry/core@npm:8.48.0":
version: 8.48.0
resolution: "@sentry/core@npm:8.48.0"
checksum: 10/1fff8fc1e0681459240ceda5a3b2a7402f7ac73da9fa72e3d6e57e8f994ac246b240739ee0f224d48646bf410980aac4213c3e334e1dcbbd806ed5f496c7bb3c
"@sentry/cloudflare@npm:^8.51.0":
version: 8.51.0
resolution: "@sentry/cloudflare@npm:8.51.0"
dependencies:
"@cloudflare/workers-types": "npm:^4.x"
"@sentry/core": "npm:8.51.0"
dependenciesMeta:
"@cloudflare/workers-types":
optional: true
checksum: 10/e3713886e07ebb65da6612fe288899e4473e760577953f338d404a9d4c1b15d30b65b5c3cb1b7209861cca8aee71850745b198f3dc71fac9899a51f2a64c640e
languageName: node
linkType: hard

"@sentry/core@npm:8.51.0":
version: 8.51.0
resolution: "@sentry/core@npm:8.51.0"
checksum: 10/02d98706e9639f97f9044d49798d64565b9fe856c1df51f4e2171a6865b221e72116a594985156eb871ec9e70494073cf1c218fac63d62a33592acd14fd13ec9
languageName: node
linkType: hard

"@sentry/node@npm:8.48.0, @sentry/node@npm:^8.48.0":
version: 8.48.0
resolution: "@sentry/node@npm:8.48.0"
"@sentry/node@npm:8.51.0, @sentry/node@npm:^8.51.0":
version: 8.51.0
resolution: "@sentry/node@npm:8.51.0"
dependencies:
"@opentelemetry/api": "npm:^1.9.0"
"@opentelemetry/context-async-hooks": "npm:^1.29.0"
Expand Down Expand Up @@ -4558,63 +4571,63 @@ __metadata:
"@opentelemetry/sdk-trace-base": "npm:^1.29.0"
"@opentelemetry/semantic-conventions": "npm:^1.28.0"
"@prisma/instrumentation": "npm:5.22.0"
"@sentry/core": "npm:8.48.0"
"@sentry/opentelemetry": "npm:8.48.0"
"@sentry/core": "npm:8.51.0"
"@sentry/opentelemetry": "npm:8.51.0"
import-in-the-middle: "npm:^1.11.2"
checksum: 10/6faa5ec46937ec3c72d3ec487bae21964ee26dfe3103d5509ab6603d31340f6a37deb0829f04d4bf5aa927b37e58aa29f6687383b03149649053477604981ba8
checksum: 10/9300ae90aa3550edd4fe08167456438e180e2d0b47dc276a4238b0889a453355c1f541c6b15e86aadaed7cfd5324e5d85309604b56c030ab709809fa0617e0dc
languageName: node
linkType: hard

"@sentry/opentelemetry@npm:8.48.0":
version: 8.48.0
resolution: "@sentry/opentelemetry@npm:8.48.0"
"@sentry/opentelemetry@npm:8.51.0":
version: 8.51.0
resolution: "@sentry/opentelemetry@npm:8.51.0"
dependencies:
"@sentry/core": "npm:8.48.0"
"@sentry/core": "npm:8.51.0"
peerDependencies:
"@opentelemetry/api": ^1.9.0
"@opentelemetry/core": ^1.29.0
"@opentelemetry/instrumentation": ^0.56.0
"@opentelemetry/sdk-trace-base": ^1.29.0
"@opentelemetry/semantic-conventions": ^1.28.0
checksum: 10/ada5bee2e709f48b7f788a8488ccd739cb3a193e45c261c8082d8517f3ae31be75596d10a9ebe71cf9d09c596f6f191a77f133696ca86c56f59393dafb3de493
checksum: 10/9534083512c705524353dac78f7cb33d94cc3680b91c40f9594b54c8c452fc0e1858dd6fc87df01fd6fdafe9d72e73a6b679b79740767388e57f0aca6c9b2017
languageName: node
linkType: hard

"@sentry/profiling-node@npm:^8.48.0":
version: 8.48.0
resolution: "@sentry/profiling-node@npm:8.48.0"
"@sentry/profiling-node@npm:^8.51.0":
version: 8.51.0
resolution: "@sentry/profiling-node@npm:8.51.0"
dependencies:
"@sentry/core": "npm:8.48.0"
"@sentry/node": "npm:8.48.0"
"@sentry/core": "npm:8.51.0"
"@sentry/node": "npm:8.51.0"
detect-libc: "npm:^2.0.2"
node-abi: "npm:^3.61.0"
node-gyp: "npm:latest"
bin:
sentry-prune-profiler-binaries: scripts/prune-profiler-binaries.js
checksum: 10/b1650af42052063a054620057ad5a31558fdb17c2fa6e79083f1789efea21d6a58d888aed22b17ed172e229ac8b58e8ead3e903118e3d9768015d349c58e14da
checksum: 10/62e93d8fe6e2f97035ca2e67ce7ef7ea36c6824708c0e458ae3941ff7543268c26194a6ab4e593bbdc1901e716bbd0850c1f9b24242208c6b4e6d075c587ed4b
languageName: node
linkType: hard

"@sentry/react@npm:^8.48.0":
version: 8.48.0
resolution: "@sentry/react@npm:8.48.0"
"@sentry/react@npm:^8.51.0":
version: 8.51.0
resolution: "@sentry/react@npm:8.51.0"
dependencies:
"@sentry/browser": "npm:8.48.0"
"@sentry/core": "npm:8.48.0"
"@sentry/browser": "npm:8.51.0"
"@sentry/core": "npm:8.51.0"
hoist-non-react-statics: "npm:^3.3.2"
peerDependencies:
react: ^16.14.0 || 17.x || 18.x || 19.x
checksum: 10/d0fe2252171106025d82c4eca2331de3942f83f81aaee7716286de4a424ece92e52b220bc38496c0f900286e47e4be7a44ea307743696ac61bb160a86a4eb696
checksum: 10/03adadb6a4fede5951158124ac4dc429f9a4df41bd0868fe8a630008e2c110114b9c4693582cc271ffca1cbc2adb3c5432ac3730f0af11b746b22d2ba35e3ab4
languageName: node
linkType: hard

"@sentry/vite-plugin@npm:^2.23.0":
version: 2.23.0
resolution: "@sentry/vite-plugin@npm:2.23.0"
"@sentry/vite-plugin@npm:^3.1.0":
version: 3.1.0
resolution: "@sentry/vite-plugin@npm:3.1.0"
dependencies:
"@sentry/bundler-plugin-core": "npm:2.23.0"
"@sentry/bundler-plugin-core": "npm:3.1.0"
unplugin: "npm:1.0.1"
checksum: 10/34b3b93a5e20e4e629602eb137bfda98d22deb0f170d9ae538f1f2687feb7533199b71cecc08ac7df6c1e5bcea2889d12aac8690577cd5fcc3ac5dd01a9e047f
checksum: 10/876a50236c78965662fe64f9f589de9c71fc34fc72a33417801940d262cb7274288c9161404be07793073beb8018c6a2c7816d8f94b1461d0abdf46202510382
languageName: node
linkType: hard

Expand Down Expand Up @@ -11760,10 +11773,10 @@ __metadata:
"@ourworldindata/utils": "workspace:^"
"@react-awesome-query-builder/antd": "npm:^6.6.0"
"@rmp135/sql-ts": "npm:^2.1.0"
"@sentry/node": "npm:^8.48.0"
"@sentry/profiling-node": "npm:^8.48.0"
"@sentry/react": "npm:^8.48.0"
"@sentry/vite-plugin": "npm:^2.23.0"
"@sentry/node": "npm:^8.51.0"
"@sentry/profiling-node": "npm:^8.51.0"
"@sentry/react": "npm:^8.51.0"
"@sentry/vite-plugin": "npm:^3.1.0"
"@sinclair/typebox": "npm:^0.28.5"
"@slack/web-api": "npm:^7.1.0"
"@testing-library/jest-dom": "npm:^6.1.3"
Expand Down Expand Up @@ -16170,6 +16183,7 @@ __metadata:
"@ourworldindata/grapher": "workspace:^"
"@ourworldindata/types": "workspace:^"
"@ourworldindata/utils": "workspace:^"
"@sentry/cloudflare": "npm:^8.51.0"
itty-router: "npm:^5.0.17"
littlezipper: "npm:^0.1.4"
stripe: "npm:^14.20.0"
Expand Down
Loading