Skip to content

Commit

Permalink
[wrangler] fix: sanitise error reports and only report unknown errors (
Browse files Browse the repository at this point in the history
…#4707)

* Revert "chore: temporarily disable sentry error reporting (#4701)"

This reverts commit 1c9817b.

* fix: sanitise sentry events

Removes PII information from Sentry events

* chore: annotate user errors

Introduces a new `UserError` base class. Instances of this class won't
be reported to Sentry.

* fix: only report non-user errors

* test: ensure only non-user errors reported and PII not included
  • Loading branch information
mrbbot authored Jan 11, 2024
1 parent 71607a0 commit 96a27f3
Show file tree
Hide file tree
Showing 65 changed files with 587 additions and 186 deletions.
7 changes: 7 additions & 0 deletions .changeset/calm-falcons-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

fix: only offer to report unknown errors

Previously, Wrangler would offer to report any error to Cloudflare. This included errors caused by misconfigurations or invalid commands. This change ensures those types of errors aren't reported.
1 change: 1 addition & 0 deletions .github/workflows/create-pullrequest-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
NODE_ENV: "production"
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_PUBLIC_KEY: ${{ secrets.ALGOLIA_PUBLIC_KEY }}
SENTRY_DSN: "https://9edbb8417b284aa2bbead9b4c318918b@sentry10.cfdata.org/583"
CI_OS: ${{ runner.os }}

- name: Pack miniflare
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/prereleases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
# this is the "test/staging" key for sparrow analytics
SPARROW_SOURCE_KEY: "5adf183f94b3436ba78d67f506965998"
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
SENTRY_DSN: "https://9edbb8417b284aa2bbead9b4c318918b@sentry10.cfdata.org/583"
ALGOLIA_PUBLIC_KEY: ${{ secrets.ALGOLIA_PUBLIC_KEY }}
working-directory: packages/wrangler

Expand Down Expand Up @@ -111,6 +112,7 @@ jobs:
NODE_ENV: "production"
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_PUBLIC_KEY: ${{ secrets.ALGOLIA_PUBLIC_KEY }}
SENTRY_DSN: "https://9edbb8417b284aa2bbead9b4c318918b@sentry10.cfdata.org/583"
CI_OS: ${{ runner.os }}

- name: Build & Publish Prerelease Registry
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_PUBLIC_KEY: ${{ secrets.ALGOLIA_PUBLIC_KEY }}
SENTRY_DSN: "https://9edbb8417b284aa2bbead9b4c318918b@sentry10.cfdata.org/583"

NODE_ENV: "production"
# This is the "production" key for sparrow analytics.
Expand Down
6 changes: 3 additions & 3 deletions packages/wrangler/src/__tests__/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8109,7 +8109,7 @@ export default{
});

await expect(runWrangler("deploy")).rejects.toMatchInlineSnapshot(
`[ParseError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]`
`[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]`
);
expect(std).toMatchInlineSnapshot(`
Object {
Expand Down Expand Up @@ -8182,7 +8182,7 @@ export default{
});

await expect(runWrangler("deploy")).rejects.toMatchInlineSnapshot(
`[ParseError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]`
`[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]`
);

expect(std).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -8252,7 +8252,7 @@ export default{
});

await expect(runWrangler("deploy")).rejects.toMatchInlineSnapshot(
`[ParseError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]`
`[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]`
);
expect(std).toMatchInlineSnapshot(`
Object {
Expand Down
Loading

0 comments on commit 96a27f3

Please sign in to comment.