Skip to content

Commit e2891fd

Browse files
authored
actions: upload sourcemaps to sentry in staging (#275)
Signed-off-by: flakey5 <[email protected]>
1 parent bed820d commit e2891fd

File tree

5 files changed

+284
-2
lines changed

5 files changed

+284
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,21 @@ jobs:
4141
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
4242
with:
4343
apiToken: ${{ secrets.CF_API_TOKEN }}
44-
command: deploy --env staging
44+
command: deploy --env staging --outdir=./dist
45+
46+
- name: Upload sourcemaps for dist-worker-staging
47+
if: github.event_name == 'push'
48+
env:
49+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
50+
runs: |
51+
npx sentry-cli sourcemaps inject --org nodejs --project dist-worker-staging ./dist && sentry-cli sourcemaps upload --org nodejs --project dist-worker-staging ./dist
4552
4653
- name: Deploy to Production
4754
if: github.event_name == 'workflow_dispatch'
4855
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
4956
with:
5057
apiToken: ${{ secrets.CF_API_TOKEN }}
51-
command: deploy --env prod
58+
command: deploy --env prod --outdir=./dist
5259

5360
- name: Alert on Failure
5461
if: failure() && github.repository == 'nodejs/release-cloudflare-worker'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node_modules/
22
.wrangler/
33
dist/
44
.dev.vars
5+
6+
.sentryclirc

package-lock.json

Lines changed: 265 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@eslint/eslintrc": "^3.2.0",
1919
"@eslint/js": "^9.32.0",
2020
"@reporters/github": "^1.7.2",
21+
"@sentry/cli": "^2.54.0",
2122
"@types/mustache": "^4.2.6",
2223
"@types/node": "^24.3.0",
2324
"@typescript-eslint/eslint-plugin": "^8.41.0",

src/worker.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ export default {
4545
execution: ctx,
4646
};
4747

48+
if (
49+
env.ENVIRONMENT === 'staging' &&
50+
request.url === '/_657ee98d-f9d3-46cd-837b-f58a88add70a'
51+
) {
52+
throw new Error('sentry source map testing');
53+
}
54+
4855
return await router.handle(request, context);
4956
} catch (e) {
5057
// Send to sentry, if it's disabled this will just noop

0 commit comments

Comments
 (0)