From 4614c2322e1cab1b7c1c7f2d5b865feaa03d5044 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Wed, 11 Jun 2025 09:08:05 +0700 Subject: [PATCH] feat: add sentry source-map upload to gateway deploy --- .gitignore | 3 +- apps/gateway/package.json | 9 ++- pnpm-lock.yaml | 162 ++++++++++++++++++++++++++++++++++++++ pnpm-workspace.yaml | 2 + readme.md | 2 +- 5 files changed, 173 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 36566bcb..f20dd5b8 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,5 @@ apps/api/auth-db-temp.json .dev.vars -.wrangler \ No newline at end of file +.wrangler +.sentryclirc diff --git a/apps/gateway/package.json b/apps/gateway/package.json index a6d984a5..f02a401a 100644 --- a/apps/gateway/package.json +++ b/apps/gateway/package.json @@ -18,14 +18,16 @@ } }, "scripts": { - "deploy": "wrangler deploy", + "deploy": "wrangler deploy --outdir dist --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)", "dev": "wrangler dev", "cf-clear-cache": "del .wrangler", "clean": "del dist", "test": "run-s test:*", "test:lint": "eslint .", "test:typecheck": "tsc --noEmit", - "test:unit": "vitest run" + "test:unit": "vitest run", + "sentry:sourcemaps": "_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=agentic-kj --project=node && sentry-cli sourcemaps upload --org=agentic-kj --project=node --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist", + "postdeploy": "pnpm sentry:sourcemaps" }, "dependencies": { "@agentic/json-schema": "workspace:*", @@ -49,6 +51,7 @@ "devDependencies": { "@cloudflare/workers-types": "catalog:", "@edge-runtime/vm": "catalog:", + "@sentry/cli": "^2.46.0", "wrangler": "catalog:" } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8ee781d2..b8119a22 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -464,6 +464,9 @@ importers: '@edge-runtime/vm': specifier: 'catalog:' version: 5.0.0 + '@sentry/cli': + specifier: ^2.46.0 + version: 2.46.0 wrangler: specifier: 'catalog:' version: 4.19.1(@cloudflare/workers-types@4.20250604.0) @@ -2425,6 +2428,58 @@ packages: '@selderee/plugin-htmlparser2@0.11.0': resolution: {integrity: sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ==} + '@sentry/cli-darwin@2.46.0': + resolution: {integrity: sha512-5Ll+e5KAdIk9OYiZO8aifMBRNWmNyPjSqdjaHlBC1Qfh7pE3b1zyzoHlsUazG0bv0sNrSGea8e7kF5wIO1hvyg==} + engines: {node: '>=10'} + os: [darwin] + + '@sentry/cli-linux-arm64@2.46.0': + resolution: {integrity: sha512-OEJN8yAjI9y5B4telyqzu27Hi3+S4T8VxZCqJz1+z2Mp0Q/MZ622AahVPpcrVq/5bxrnlZR16+lKh8L1QwNFPg==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux, freebsd, android] + + '@sentry/cli-linux-arm@2.46.0': + resolution: {integrity: sha512-WRrLNq/TEX/TNJkGqq6Ad0tGyapd5dwlxtsPbVBrIdryuL1mA7VCBoaHBr3kcwJLsgBHFH0lmkMee2ubNZZdkg==} + engines: {node: '>=10'} + cpu: [arm] + os: [linux, freebsd, android] + + '@sentry/cli-linux-i686@2.46.0': + resolution: {integrity: sha512-xko3/BVa4LX8EmRxVOCipV+PwfcK5Xs8lP6lgF+7NeuAHMNL4DqF6iV9rrN8gkGUHCUI9RXSve37uuZnFy55+Q==} + engines: {node: '>=10'} + cpu: [x86, ia32] + os: [linux, freebsd, android] + + '@sentry/cli-linux-x64@2.46.0': + resolution: {integrity: sha512-hJ1g5UEboYcOuRia96LxjJ0jhnmk8EWLDvlGnXLnYHkwy3ree/L7sNgdp/QsY8Z4j2PGO5f22Va+UDhSjhzlfQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux, freebsd, android] + + '@sentry/cli-win32-arm64@2.46.0': + resolution: {integrity: sha512-mN7cpPoCv2VExFRGHt+IoK11yx4pM4ADZQGEso5BAUZ5duViXB2WrAXCLd8DrwMnP0OE978a7N8OtzsFqjkbNA==} + engines: {node: '>=10'} + cpu: [arm64] + os: [win32] + + '@sentry/cli-win32-i686@2.46.0': + resolution: {integrity: sha512-6F73AUE3lm71BISUO19OmlnkFD5WVe4/wA1YivtLZTc1RU3eUYJLYxhDfaH3P77+ycDppQ2yCgemLRaA4A8mNQ==} + engines: {node: '>=10'} + cpu: [x86, ia32] + os: [win32] + + '@sentry/cli-win32-x64@2.46.0': + resolution: {integrity: sha512-yuGVcfepnNL84LGA0GjHzdMIcOzMe0bjPhq/rwPsPN+zu11N+nPR2wV2Bum4U0eQdqYH3iAlMdL5/BEQfuLJww==} + engines: {node: '>=10'} + cpu: [x64] + os: [win32] + + '@sentry/cli@2.46.0': + resolution: {integrity: sha512-nqoPl7UCr446QFkylrsRrUXF51x8Z9dGquyf4jaQU+OzbOJMqclnYEvU6iwbwvaw3tu/2DnoZE/Og+Nq1h63sA==} + engines: {node: '>= 10'} + hasBin: true + '@sentry/cloudflare@9.26.0': resolution: {integrity: sha512-1cdpcnjqzQRNb26sYa/k0U48cv8AkFsAbUR6Fo4qWhpLA70sfyOX1ukrEkl6Y3vCiKHBjaHlaiqEqkvcWGgHiQ==} engines: {node: '>=18'} @@ -2692,6 +2747,10 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + agent-base@7.1.3: resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==} engines: {node: '>= 14'} @@ -3848,6 +3907,10 @@ packages: resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==} engines: {node: '>= 0.8'} + https-proxy-agent@5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + https-proxy-agent@7.0.6: resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} engines: {node: '>= 14'} @@ -4421,6 +4484,15 @@ packages: sass: optional: true + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + node-releases@2.0.19: resolution: {integrity: sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==} @@ -4737,6 +4809,10 @@ packages: resolution: {integrity: sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==} engines: {node: '>=6'} + progress@2.0.3: + resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} + engines: {node: '>=0.4.0'} + prop-types@15.8.1: resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} @@ -4744,6 +4820,9 @@ packages: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} engines: {node: '>= 0.10'} + proxy-from-env@1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -5246,6 +5325,9 @@ packages: toucan-js@4.1.1: resolution: {integrity: sha512-GTPwEaCRN8IbYe5/VeGiwxYvMO0dKaC16fTeLbF+QGswjkLZ9JUqAfDhLMyH2SWukYhmetH+uxWa1Bhluv/evQ==} + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + tr46@1.0.1: resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} @@ -5531,9 +5613,15 @@ packages: resolution: {integrity: sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==} engines: {node: 20 || >=22} + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + webidl-conversions@4.0.2: resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + whatwg-url@7.1.0: resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} @@ -7100,6 +7188,50 @@ snapshots: domhandler: 5.0.3 selderee: 0.11.0 + '@sentry/cli-darwin@2.46.0': + optional: true + + '@sentry/cli-linux-arm64@2.46.0': + optional: true + + '@sentry/cli-linux-arm@2.46.0': + optional: true + + '@sentry/cli-linux-i686@2.46.0': + optional: true + + '@sentry/cli-linux-x64@2.46.0': + optional: true + + '@sentry/cli-win32-arm64@2.46.0': + optional: true + + '@sentry/cli-win32-i686@2.46.0': + optional: true + + '@sentry/cli-win32-x64@2.46.0': + optional: true + + '@sentry/cli@2.46.0': + dependencies: + https-proxy-agent: 5.0.1 + node-fetch: 2.7.0 + progress: 2.0.3 + proxy-from-env: 1.1.0 + which: 2.0.2 + optionalDependencies: + '@sentry/cli-darwin': 2.46.0 + '@sentry/cli-linux-arm': 2.46.0 + '@sentry/cli-linux-arm64': 2.46.0 + '@sentry/cli-linux-i686': 2.46.0 + '@sentry/cli-linux-x64': 2.46.0 + '@sentry/cli-win32-arm64': 2.46.0 + '@sentry/cli-win32-i686': 2.46.0 + '@sentry/cli-win32-x64': 2.46.0 + transitivePeerDependencies: + - encoding + - supports-color + '@sentry/cloudflare@9.26.0(@cloudflare/workers-types@4.20250604.0)': dependencies: '@sentry/core': 9.26.0 @@ -7428,6 +7560,12 @@ snapshots: acorn@8.14.1: {} + agent-base@6.0.2: + dependencies: + debug: 4.4.1(supports-color@10.0.0) + transitivePeerDependencies: + - supports-color + agent-base@7.1.3: {} agents@0.0.95(@cloudflare/workers-types@4.20250604.0)(react@19.1.0): @@ -8752,6 +8890,13 @@ snapshots: statuses: 2.0.1 toidentifier: 1.0.1 + https-proxy-agent@5.0.1: + dependencies: + agent-base: 6.0.2 + debug: 4.4.1(supports-color@10.0.0) + transitivePeerDependencies: + - supports-color + https-proxy-agent@7.0.6(supports-color@10.0.0): dependencies: agent-base: 7.1.3 @@ -9283,6 +9428,10 @@ snapshots: - '@babel/core' - babel-plugin-macros + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + node-releases@2.0.19: {} normalize-path@3.0.0: {} @@ -9604,6 +9753,8 @@ snapshots: prismjs@1.30.0: {} + progress@2.0.3: {} + prop-types@15.8.1: dependencies: loose-envify: 1.4.0 @@ -9615,6 +9766,8 @@ snapshots: forwarded: 0.2.0 ipaddr.js: 1.9.1 + proxy-from-env@1.1.0: {} + punycode@2.3.1: {} qs@6.14.0: @@ -10255,6 +10408,8 @@ snapshots: '@sentry/types': 8.9.2 '@sentry/utils': 8.9.2 + tr46@0.0.3: {} + tr46@1.0.1: dependencies: punycode: 2.3.1 @@ -10554,8 +10709,15 @@ snapshots: walk-up-path@4.0.0: {} + webidl-conversions@3.0.1: {} + webidl-conversions@4.0.2: {} + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + whatwg-url@7.1.0: dependencies: lodash.sortby: 4.7.0 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 1571c347..0bf66ae2 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -82,3 +82,5 @@ catalog: zod: ^3.25.51 zod-to-json-schema: ^3.24.5 zod-validation-error: ^3.4.1 +onlyBuiltDependencies: + - '@sentry/cli' diff --git a/readme.md b/readme.md index 59a61d27..2139c75a 100644 --- a/readme.md +++ b/readme.md @@ -36,7 +36,7 @@ - openapi-kitchen-sink - mcp-kitchen-sink - how to handle binary bodies and responses? - - add support for `immutable` in `toolConfigs` + - `recordToolCallUsage` in `finally` block of http flow - improve logger vs console for non-hono path and util methods - **Public MCP server interface** - how does oauth work with this flow?