From ca6119ff22782d573e9429d1dab7bc214b42a7cd Mon Sep 17 00:00:00 2001 From: Dylan Audius Date: Fri, 15 May 2026 13:55:48 -0700 Subject: [PATCH] chore: remove Sentry from the entire monorepo Removes the Sentry SDK (web + mobile + identity-service), the redux-sentry-middleware, the @sentry/cli release-cut job, and every call site of reportToSentry / ErrorLevel / Feature. Most reportToSentry({...}) calls become console.error(...) with the same context payload. The ErrorReporting model and the sentry + reportToSentry properties on CommonStoreContext / QueryContext are deleted. SENTRY_DSN is dropped from web and mobile env + the Env type, toucan-js is removed from the SSR worker, and the iOS dSYM upload script, sentry.properties files, and CI sentry-cli steps go too. verify (tsc + eslint) passes clean for common, web, and mobile after the SDK and harmony are built locally. The two pre-existing identity-service tsc errors are unrelated to this change. Co-Authored-By: Claude Opus 4.7 (1M context) --- .circleci/src/commands/@mobile-commands.yml | 5 - .circleci/src/jobs/@web-jobs.yml | 24 - .circleci/src/workflows/web.yml | 8 - .github/workflows/mobile.yml | 16 - .github/workflows/web.yml | 89 --- package-lock.json | 621 +----------------- package.json | 1 - .../api/tan-query/coins/useFanClubByTicker.ts | 2 +- .../src/api/tan-query/coins/useRedeemCoin.ts | 12 +- .../api/tan-query/coins/useRedeemCoinCode.ts | 12 +- .../collection/useDeleteCollection.ts | 14 +- .../src/api/tan-query/comments/useComment.ts | 12 +- .../tan-query/comments/useCommentReplies.ts | 12 +- .../tan-query/comments/useDeleteComment.ts | 11 +- .../tan-query/comments/useDeleteTextPost.ts | 11 +- .../api/tan-query/comments/useEditComment.ts | 11 +- .../tan-query/comments/useEventComments.ts | 12 +- .../api/tan-query/comments/useFanClubFeed.ts | 12 +- .../src/api/tan-query/comments/useMuteUser.ts | 11 +- .../api/tan-query/comments/usePinComment.ts | 11 +- .../api/tan-query/comments/usePostComment.ts | 11 +- .../tan-query/comments/usePostEventComment.ts | 11 +- .../tan-query/comments/usePostTextUpdate.ts | 11 +- .../tan-query/comments/useReactToComment.ts | 11 +- .../tan-query/comments/useReportComment.ts | 11 +- .../tan-query/comments/useTrackComments.ts | 12 +- .../useUpdateCommentNotificationSetting.ts | 11 +- ...seUpdateTrackCommentNotificationSetting.ts | 11 +- .../api/tan-query/comments/useUserComments.ts | 12 +- .../api/tan-query/events/useCreateEvent.ts | 11 +- .../api/tan-query/events/useDeleteEvent.ts | 11 +- .../api/tan-query/events/useEventFollowers.ts | 10 +- .../api/tan-query/events/useFollowEvent.ts | 18 +- .../api/tan-query/events/useUpdateEvent.ts | 11 +- .../src/api/tan-query/jupiter/useSwapCoins.ts | 46 +- .../api/tan-query/tracks/useDeleteTrack.ts | 10 +- .../tan-query/tracks/useDownloadTrackStems.ts | 9 +- .../api/tan-query/tracks/useFavoriteTrack.ts | 12 +- .../tan-query/tracks/useUnfavoriteTrack.ts | 12 +- .../api/tan-query/tracks/useUpdateTrack.ts | 23 +- .../tan-query/upload/usePublishCollection.ts | 7 +- .../api/tan-query/upload/usePublishStems.ts | 2 +- .../api/tan-query/upload/usePublishTracks.ts | 19 +- .../src/api/tan-query/upload/useUpload.ts | 25 +- .../api/tan-query/upload/useUploadFiles.ts | 11 +- .../users/account/useResendRecoveryEmail.ts | 11 +- .../src/api/tan-query/users/useFollowUser.ts | 18 +- .../api/tan-query/users/useUnfollowUser.ts | 18 +- .../api/tan-query/users/useUpdateProfile.ts | 12 +- .../src/api/tan-query/utils/QueryContext.ts | 6 +- .../src/api/tan-query/utils/defaultConfig.ts | 29 +- .../tan-query/wallets/useAssociatedWallets.ts | 14 +- .../api/tan-query/wallets/useAudioBalance.ts | 12 +- .../wallets/useExternalWalletBalance.ts | 16 +- .../src/api/tan-query/wallets/useSendCoins.ts | 17 +- .../src/hooks/chats/useSetInboxPermissions.ts | 9 +- .../hooks/useChangeEmailFormConfiguration.ts | 5 +- packages/common/src/hooks/useShareAction.ts | 19 +- packages/common/src/models/ErrorReporting.ts | 84 --- packages/common/src/models/index.ts | 1 - .../services/audius-backend/AudiusBackend.ts | 8 +- packages/common/src/services/env.ts | 1 - .../src/services/remote-config/defaults.ts | 3 +- .../src/services/remote-config/types.ts | 5 +- packages/common/src/store/account/sagas.ts | 121 +--- packages/common/src/store/buy-usdc/sagas.ts | 14 +- packages/common/src/store/pages/chat/sagas.ts | 175 +---- packages/common/src/store/playback/slice.ts | 3 +- .../src/store/purchase-content/sagas.ts | 9 +- packages/common/src/store/storeContext.ts | 6 - .../src/store/ui/stripe-modal/sagaHelpers.ts | 18 +- .../common/src/store/ui/stripe-modal/sagas.ts | 18 +- .../src/store/ui/withdraw-usdc/sagas.ts | 18 +- packages/common/src/utils/sagaHelpers.ts | 14 +- packages/embed/src/util/logError.js | 1 - packages/identity-service/default-config.json | 1 - packages/identity-service/package.json | 1 - packages/identity-service/src/app.js | 12 - packages/identity-service/src/config.js | 6 - packages/mobile/android/sentry.properties | 4 - .../project.pbxproj | 15 - packages/mobile/ios/Podfile | 4 +- .../ios/scripts/uploadSentryDebugSymbols.sh | 3 - packages/mobile/ios/sentry.properties | 4 - packages/mobile/src/app/App.tsx | 7 +- .../mobile/src/app/AudiusQueryProvider.tsx | 2 - packages/mobile/src/app/ErrorBoundary.tsx | 8 +- packages/mobile/src/app/sentry.ts | 8 - .../src/components/audio/AudioPlayer.tsx | 15 +- .../DownloadTrackArchiveDrawer.tsx | 12 +- .../NavigationContainer.tsx | 7 +- .../send-tokens-drawer/SendTokensDrawer.tsx | 14 +- .../share-drawer/useShareToStory.tsx | 9 +- .../EditCoinDetailsScreen.tsx | 16 +- .../NotificationErrorBoundary.tsx | 9 +- .../src/services/audius-backend-instance.ts | 3 +- packages/mobile/src/services/env/env.dev.ts | 1 - packages/mobile/src/services/env/env.prod.ts | 1 - packages/mobile/src/services/query-client.ts | 3 +- .../remote-config/remote-config-instance.ts | 8 +- packages/mobile/src/store/store.ts | 8 - packages/mobile/src/store/storeContext.ts | 6 - packages/mobile/src/utils/reportToSentry.ts | 66 -- packages/web/package.json | 4 - packages/web/src/app/AppErrorBoundary.tsx | 4 +- packages/web/src/app/AudiusQueryProvider.tsx | 2 - packages/web/src/app/web-player/WebPlayer.tsx | 12 - .../common/store/pages/audio-rewards/sagas.ts | 13 - .../src/common/store/pages/signon/sagas.ts | 164 +---- .../web/src/common/store/pages/track/sagas.ts | 14 +- .../src/common/store/playback/errorSagas.ts | 4 +- .../web/src/common/store/playback/sagas.ts | 4 +- .../store/social/collections/errorSagas.ts | 4 +- .../common/store/social/tracks/errorSagas.ts | 4 +- .../common/store/social/users/errorSagas.ts | 4 +- .../components/error-wrapper/ErrorWrapper.tsx | 15 +- .../componentWithErrorBoundary.tsx | 4 +- .../instagram-auth/InstagramAuth.tsx | 34 +- .../payout-wallet-modal/PayoutWalletModal.tsx | 7 +- .../send-tokens-modal/SendTokensModal.tsx | 20 +- .../web/src/components/x-auth/XAuthButton.tsx | 29 +- packages/web/src/hooks/useClaimFees.ts | 12 +- packages/web/src/hooks/useClaimVestedCoins.ts | 12 +- .../src/hooks/useConnectExternalWallets.ts | 22 +- .../web/src/hooks/useExternalWalletSwap.ts | 21 +- packages/web/src/hooks/useLaunchCoin.ts | 55 +- .../modals/ConnectedWalletsModal.tsx | 16 +- .../EditCoinDetailsPage.tsx | 24 +- .../components/FanClubInfoSection.tsx | 25 +- .../LaunchpadPage.tsx | 96 +-- .../pages/SetupPage.tsx | 13 +- .../fan-clubs-launchpad-page/validation.ts | 18 +- .../useUploadContestCover.ts | 10 +- .../pages/oauth-login-page/OAuthLoginPage.tsx | 5 +- .../oauth-login-page/OAuthSignUpPage.tsx | 7 +- .../web/src/pages/oauth-login-page/hooks.ts | 10 +- .../pages/upload-page/pages/SelectPage.tsx | 15 +- .../audius-backend/audius-backend-instance.ts | 3 +- packages/web/src/services/env/env.dev.ts | 1 - packages/web/src/services/env/env.prod.ts | 1 - packages/web/src/services/query-client.ts | 4 +- .../remote-config/remote-config-instance.ts | 12 +- packages/web/src/services/sentry.ts | 182 ----- packages/web/src/ssr/worker.js | 13 +- .../store/application/ui/stemsUpload/sagas.ts | 2 - packages/web/src/store/configureStore.ts | 135 +--- packages/web/src/store/errors/actions.ts | 17 +- .../web/src/store/errors/reportToSentry.ts | 83 --- packages/web/src/store/errors/sagas.ts | 9 +- packages/web/src/store/reload/sagas.ts | 9 +- packages/web/src/store/storeContext.ts | 16 - packages/web/src/utils/errorSagas.ts | 10 +- 152 files changed, 429 insertions(+), 2954 deletions(-) delete mode 100644 packages/common/src/models/ErrorReporting.ts delete mode 100644 packages/mobile/android/sentry.properties delete mode 100755 packages/mobile/ios/scripts/uploadSentryDebugSymbols.sh delete mode 100644 packages/mobile/ios/sentry.properties delete mode 100644 packages/mobile/src/app/sentry.ts delete mode 100644 packages/mobile/src/utils/reportToSentry.ts delete mode 100644 packages/web/src/services/sentry.ts delete mode 100644 packages/web/src/store/errors/reportToSentry.ts diff --git a/.circleci/src/commands/@mobile-commands.yml b/.circleci/src/commands/@mobile-commands.yml index 850930e0fe7..fa90ea9c1c2 100644 --- a/.circleci/src/commands/@mobile-commands.yml +++ b/.circleci/src/commands/@mobile-commands.yml @@ -38,11 +38,6 @@ mobile-prepare-ios: command: | cd packages/mobile/ios bundle exec pod install - - run: - name: Install Sentry CLI - command: | - curl -sL https://sentry.io/get-cli/ | bash - echo export SENTRY_BINARY=/usr/local/bin/sentry-cli >> "$BASH_ENV" - run: name: Build dependencies no_output_timeout: 60m diff --git a/.circleci/src/jobs/@web-jobs.yml b/.circleci/src/jobs/@web-jobs.yml index 8ac409f4a9c..d908a9f5a2b 100644 --- a/.circleci/src/jobs/@web-jobs.yml +++ b/.circleci/src/jobs/@web-jobs.yml @@ -143,30 +143,6 @@ web-deploy-production-cloudflare: copy-robots: true # - web-deploy-sourcemaps-s3 -web-deploy-sentry-sourcemaps: - working_directory: ~/apps - docker: - - image: cimg/node:20.19 - steps: - - checkout - - attach_workspace: - at: ./ - - run: - name: cut-sentry-release - command: | - cd packages/web - ../../node_modules/.bin/sentry-cli --auth-token ${SENTRY_AUTH_TOKEN} releases --org audius --project audius-client new ${CIRCLE_SHA1} - - run: - name: upload-sourcemaps - command: | - cd packages/web - ../../node_modules/.bin/sentry-cli --auth-token ${SENTRY_AUTH_TOKEN} releases --org audius --project audius-client files ${CIRCLE_SHA1} upload-sourcemaps --no-rewrite build-production/static/js - - run: - name: finalize-release - command: | - cd packages/web - ../../node_modules/.bin/sentry-cli --auth-token ${SENTRY_AUTH_TOKEN} releases --org audius --project audius-client finalize ${CIRCLE_SHA1} - web-dist-mac-production: working_directory: ~/apps # run on macos so dmg can be created and signed. diff --git a/.circleci/src/workflows/web.yml b/.circleci/src/workflows/web.yml index 3a5fcdac6dd..95916d4802a 100644 --- a/.circleci/src/workflows/web.yml +++ b/.circleci/src/workflows/web.yml @@ -70,14 +70,6 @@ jobs: filters: branches: only: /^main$/ - - web-deploy-sentry-sourcemaps: - context: Audius Client - requires: - - web-hold-production - filters: - branches: - only: /^main$/ - # Distribute production desktop binaries on main. - web-hold-dist-mac-production: type: approval diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index b662c7dfe9b..ca9306aca00 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -501,11 +501,6 @@ jobs: cd packages/mobile/ios RCT_NEW_ARCH_ENABLED=0 bundle exec pod install - - name: Install Sentry CLI - run: | - curl -sL https://sentry.io/get-cli/ | bash - echo "$HOME/.sentry-cli/bin" >> $GITHUB_PATH - - name: Build dependencies timeout-minutes: 60 run: npx turbo run build --filter=@audius/mobile @@ -559,9 +554,6 @@ jobs: APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }} APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG }} - SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} run: | cd packages/mobile/ios bundle exec fastlane build_and_upload bundle_id:co.audius.audiusmusic.releasecandidate @@ -888,11 +880,6 @@ jobs: cd packages/mobile/ios RCT_NEW_ARCH_ENABLED=0 bundle exec pod install - - name: Install Sentry CLI - run: | - curl -sL https://sentry.io/get-cli/ | bash - echo "$HOME/.sentry-cli/bin" >> $GITHUB_PATH - - name: Build dependencies timeout-minutes: 60 run: npx turbo run build --filter=@audius/mobile @@ -946,9 +933,6 @@ jobs: APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }} APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }} APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG }} - SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} run: | cd packages/mobile/ios bundle exec fastlane build_and_upload bundle_id:co.audius.audiusmusic diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 95ba393d1d5..c20c26b16c2 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -837,92 +837,3 @@ jobs: job_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" json_content="{ \"blocks\": [{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed production <${job_url}|v${deploying_version}> to web \n\" } }]}" curl -f -X POST -H 'Content-type: application/json' --data "$json_content" $SLACK_WEBHOOK - - web-deploy-sentry-sourcemaps: - name: Web Deploy Sentry Sourcemaps - runs-on: ubuntu-latest - needs: [web-build, web-check-ssr-bundlesize] - if: github.ref == 'refs/heads/main' - environment: - name: production - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Create concatenated patch file - id: patch-file - run: | - ls -d -- packages/*/patches/*.patch 2>/dev/null | xargs cat > combined-patch-file.txt || touch combined-patch-file.txt - echo "patch_checksum=$(sha256sum combined-patch-file.txt | cut -d' ' -f1)" >> $GITHUB_OUTPUT - - - name: Cache node modules - id: cache-node-modules - uses: actions/cache@v4 - with: - path: | - node_modules - packages/web/node_modules - packages/harmony/node_modules - packages/common/node_modules - packages/libs/node_modules - packages/sdk/node_modules - key: npm-cache-${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}-${{ steps.patch-file.outputs.patch_checksum }} - restore-keys: | - npm-cache-${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}- - - - name: Install dependencies (if cache miss) - if: steps.cache-node-modules.outputs.cache-hit != 'true' - env: - CI: true - SKIP_POD_INSTALL: true - SKIP_ANDROID_INSTALL: true - ANDROID_HOME: /tmp/android-sdk-dummy - NODE_OPTIONS: --max-old-space-size=8192 - run: | - mkdir -p /tmp/android-sdk-dummy - npm ci --prefer-offline - - - name: Run postinstall (if cache hit) - if: steps.cache-node-modules.outputs.cache-hit == 'true' - env: - CI: true - SKIP_POD_INSTALL: true - SKIP_ANDROID_INSTALL: true - ANDROID_HOME: /tmp/android-sdk-dummy - NODE_OPTIONS: --max-old-space-size=8192 - run: | - mkdir -p /tmp/android-sdk-dummy - npm run postinstall - - - name: Download builds - uses: actions/download-artifact@v4 - with: - name: builds - path: packages/web - - - name: Cut Sentry release - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - run: | - cd packages/web - ../../node_modules/.bin/sentry-cli --auth-token ${SENTRY_AUTH_TOKEN} releases --org audius --project audius-client new ${{ github.sha }} - - - name: Upload sourcemaps - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - run: | - cd packages/web - ../../node_modules/.bin/sentry-cli --auth-token ${SENTRY_AUTH_TOKEN} sourcemaps upload --org audius --project audius-client --release ${{ github.sha }} build-production/static/js - - - name: Finalize release - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - run: | - cd packages/web - ../../node_modules/.bin/sentry-cli --auth-token ${SENTRY_AUTH_TOKEN} releases --org audius --project audius-client finalize ${{ github.sha }} - diff --git a/package-lock.json b/package-lock.json index 985b4c4caa0..8acc1252e08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,6 @@ }, "devDependencies": { "@emotion/eslint-plugin": "11.12.0", - "@sentry/cli": "3.1.0", "@tsconfig/strictest": "2.0.2", "@types/keyv": "4.2.0", "@types/react": "19.0.0", @@ -32943,470 +32942,6 @@ "node": "6.* || 8.* || >=10.*" } }, - "node_modules/@sentry-internal/feedback": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.117.0.tgz", - "integrity": "sha512-4X+NnnY17W74TymgLFH7/KPTVYpEtoMMJh8HzVdCmHTOE6j32XKBeBMRaXBhmNYmEgovgyRKKf2KvtSfgw+V1Q==", - "license": "MIT", - "dependencies": { - "@sentry/core": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@sentry-internal/replay-canvas": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-7.117.0.tgz", - "integrity": "sha512-7hjIhwEcoosr+BIa0AyEssB5xwvvlzUpvD5fXu4scd3I3qfX8gdnofO96a8r+LrQm3bSj+eN+4TfKEtWb7bU5A==", - "license": "MIT", - "dependencies": { - "@sentry/core": "7.117.0", - "@sentry/replay": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@sentry-internal/tracing": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.117.0.tgz", - "integrity": "sha512-fAIyijNvKBZNA12IcKo+dOYDRTNrzNsdzbm3DP37vJRKVQu19ucqP4Y6InvKokffDP2HZPzFPDoGXYuXkDhUZg==", - "license": "MIT", - "dependencies": { - "@sentry/core": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/browser": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.117.0.tgz", - "integrity": "sha512-29X9HlvDEKIaWp6XKlNPPSNND0U6P/ede5WA2nVHfs1zJLWdZ7/ijuMc0sH/CueEkqHe/7gt94hBcI7HOU/wSw==", - "license": "MIT", - "dependencies": { - "@sentry-internal/feedback": "7.117.0", - "@sentry-internal/replay-canvas": "7.117.0", - "@sentry-internal/tracing": "7.117.0", - "@sentry/core": "7.117.0", - "@sentry/integrations": "7.117.0", - "@sentry/replay": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/cli": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-3.1.0.tgz", - "integrity": "sha512-ngnx6E8XjXpg1uzma45INfKCS8yurb/fl3cZdXTCa2wmek8b4N6WIlmOlTKFTBrV54OauF6mloJxAlpuzoQR6g==", - "dev": true, - "hasInstallScript": true, - "license": "FSL-1.1-MIT", - "dependencies": { - "progress": "^2.0.3", - "proxy-from-env": "^1.1.0", - "undici": "^6.22.0", - "which": "^2.0.2" - }, - "bin": { - "sentry-cli": "bin/sentry-cli" - }, - "engines": { - "node": ">= 18" - }, - "optionalDependencies": { - "@sentry/cli-darwin": "3.1.0", - "@sentry/cli-linux-arm": "3.1.0", - "@sentry/cli-linux-arm64": "3.1.0", - "@sentry/cli-linux-i686": "3.1.0", - "@sentry/cli-linux-x64": "3.1.0", - "@sentry/cli-win32-arm64": "3.1.0", - "@sentry/cli-win32-i686": "3.1.0", - "@sentry/cli-win32-x64": "3.1.0" - } - }, - "node_modules/@sentry/cli-darwin": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-3.1.0.tgz", - "integrity": "sha512-xT1WlCHenGGO29Lq/wKaIthdqZzNzZhlPs7dXrzlBx9DyA2Jnl0g7WEau0oWi8GyJGVRXCJMiCydR//Tb5qVwA==", - "dev": true, - "license": "FSL-1.1-MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@sentry/cli-linux-arm": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm/-/cli-linux-arm-3.1.0.tgz", - "integrity": "sha512-kbP3/8/Ct/Jbm569KDXbFIyMyPypIegObvIT7LdSsfdYSZdBd396GV7vUpSGKiLUVVN0xjn8OqQ48AVGfjmuMg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "FSL-1.1-MIT", - "optional": true, - "os": [ - "linux", - "freebsd", - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@sentry/cli-linux-arm64": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm64/-/cli-linux-arm64-3.1.0.tgz", - "integrity": "sha512-Jm/iHLKiHxrZYlAq2tT07amiegEVCOAQT9Unilr6djjcZzS2tcI9ThSRQvjP9tFpFRKop+NyNGE3XHXf69r00g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "FSL-1.1-MIT", - "optional": true, - "os": [ - "linux", - "freebsd", - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@sentry/cli-linux-i686": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-linux-i686/-/cli-linux-i686-3.1.0.tgz", - "integrity": "sha512-f/PK/EGK5vFOy7LC4Riwb+BEE20Nk7RbEFEMjvRq26DpETCrZYUGlbpIKvJFKOaUmr79aAkFCA/EjJiYfcQP2Q==", - "cpu": [ - "x86", - "ia32" - ], - "dev": true, - "license": "FSL-1.1-MIT", - "optional": true, - "os": [ - "linux", - "freebsd", - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@sentry/cli-linux-x64": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-linux-x64/-/cli-linux-x64-3.1.0.tgz", - "integrity": "sha512-T+v8x1ujhixZrOrH0sVhsW6uLwK4n0WS+B+5xV46WqUKe32cbYotursp2y53ROjgat8SQDGeP/VnC0Qa3Y2fEA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "FSL-1.1-MIT", - "optional": true, - "os": [ - "linux", - "freebsd", - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@sentry/cli-win32-arm64": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-win32-arm64/-/cli-win32-arm64-3.1.0.tgz", - "integrity": "sha512-2DIPq6aW2DC34EDC9J0xwD+9BpFnKdFGdIcQUZMS+5pXlU6V7o8wpZxZAM8TdYNmsPkkQGKp7Dhl/arWpvNgrw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "FSL-1.1-MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@sentry/cli-win32-i686": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-win32-i686/-/cli-win32-i686-3.1.0.tgz", - "integrity": "sha512-2NuywEiiZn6xJ1yAV2xjv/nuHiy6kZU5XR3RSAIrPdEZD1nBoMsH/gB2FufQw58Ziz/7otFcX+vtGpJjbIT5mQ==", - "cpu": [ - "x86", - "ia32" - ], - "dev": true, - "license": "FSL-1.1-MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@sentry/cli-win32-x64": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sentry/cli-win32-x64/-/cli-win32-x64-3.1.0.tgz", - "integrity": "sha512-Ip405Yqdrr+l9TImsZOJz6c9Nb4zvXcmtOIBKLHc9cowpfXfmlqsHbDp7Xh4+k4L0uLr9i+8ilgQ6ypcuF4UCg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "FSL-1.1-MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@sentry/cli/node_modules/undici": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz", - "integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.17" - } - }, - "node_modules/@sentry/core": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.117.0.tgz", - "integrity": "sha512-1XZ4/d/DEwnfM2zBMloXDwX+W7s76lGKQMgd8bwgPJZjjEztMJ7X0uopKAGwlQcjn242q+hsCBR6C+fSuI5kvg==", - "license": "MIT", - "dependencies": { - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/hub": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/types": "6.2.5", - "@sentry/utils": "6.2.5", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/hub/node_modules/@sentry/types": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/hub/node_modules/@sentry/utils": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/types": "6.2.5", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/hub/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "license": "0BSD" - }, - "node_modules/@sentry/integrations": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.117.0.tgz", - "integrity": "sha512-U3suSZysmU9EiQqg0ga5CxveAyNbi9IVdsapMDq5EQGNcVDvheXtULs+BOc11WYP3Kw2yWB38VDqLepfc/Fg2g==", - "license": "MIT", - "dependencies": { - "@sentry/core": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0", - "localforage": "^1.8.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/minimal": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/hub": "6.2.5", - "@sentry/types": "6.2.5", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/minimal/node_modules/@sentry/types": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/minimal/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "license": "0BSD" - }, - "node_modules/@sentry/node": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/core": "6.2.5", - "@sentry/hub": "6.2.5", - "@sentry/tracing": "6.2.5", - "@sentry/types": "6.2.5", - "@sentry/utils": "6.2.5", - "cookie": "^0.4.1", - "https-proxy-agent": "^5.0.0", - "lru_map": "^0.3.3", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/node/node_modules/@sentry/core": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/hub": "6.2.5", - "@sentry/minimal": "6.2.5", - "@sentry/types": "6.2.5", - "@sentry/utils": "6.2.5", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/node/node_modules/@sentry/types": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/node/node_modules/@sentry/utils": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/types": "6.2.5", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/node/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "license": "0BSD" - }, - "node_modules/@sentry/replay": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.117.0.tgz", - "integrity": "sha512-V4DfU+x4UsA4BsufbQ8jHYa5H0q5PYUgso2X1PR31g1fpx7yiYguSmCfz1UryM6KkH92dfTnqXapDB44kXOqzQ==", - "license": "MIT", - "dependencies": { - "@sentry-internal/tracing": "7.117.0", - "@sentry/core": "7.117.0", - "@sentry/types": "7.117.0", - "@sentry/utils": "7.117.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@sentry/tracing": { - "version": "6.2.5", - "license": "MIT", - "dependencies": { - "@sentry/hub": "6.2.5", - "@sentry/minimal": "6.2.5", - "@sentry/types": "6.2.5", - "@sentry/utils": "6.2.5", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/tracing/node_modules/@sentry/types": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/tracing/node_modules/@sentry/utils": { - "version": "6.2.5", - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/types": "6.2.5", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/tracing/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "license": "0BSD" - }, - "node_modules/@sentry/types": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.117.0.tgz", - "integrity": "sha512-5dtdulcUttc3F0Te7ekZmpSp/ebt/CA71ELx0uyqVGjWsSAINwskFD77sdcjqvZWek//WjiYX1+GRKlpJ1QqsA==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@sentry/utils": { - "version": "7.117.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.117.0.tgz", - "integrity": "sha512-KkcLY8643SGBiDyPvMQOubBkwVX5IPknMHInc7jYC8pDVncGp7C65Wi506bCNPpKCWspUd/0VDNWOOen51/qKA==", - "license": "MIT", - "dependencies": { - "@sentry/types": "7.117.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/@shikijs/core": { "version": "1.29.2", "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.29.2.tgz", @@ -38420,97 +37955,6 @@ "redux-saga": "*" } }, - "node_modules/@types/redux-sentry-middleware": { - "version": "0.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@sentry/browser": "^5.0.0 || ^6.0.0", - "redux": "^4.0.0" - } - }, - "node_modules/@types/redux-sentry-middleware/node_modules/@sentry/browser": { - "version": "6.19.7", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/core": "6.19.7", - "@sentry/types": "6.19.7", - "@sentry/utils": "6.19.7", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@types/redux-sentry-middleware/node_modules/@sentry/core": { - "version": "6.19.7", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/hub": "6.19.7", - "@sentry/minimal": "6.19.7", - "@sentry/types": "6.19.7", - "@sentry/utils": "6.19.7", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@types/redux-sentry-middleware/node_modules/@sentry/hub": { - "version": "6.19.7", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/types": "6.19.7", - "@sentry/utils": "6.19.7", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@types/redux-sentry-middleware/node_modules/@sentry/minimal": { - "version": "6.19.7", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/hub": "6.19.7", - "@sentry/types": "6.19.7", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@types/redux-sentry-middleware/node_modules/@sentry/types": { - "version": "6.19.7", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=6" - } - }, - "node_modules/@types/redux-sentry-middleware/node_modules/@sentry/utils": { - "version": "6.19.7", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sentry/types": "6.19.7", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@types/redux-sentry-middleware/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true, - "license": "0BSD" - }, "node_modules/@types/request-ip": { "version": "0.0.41", "dev": true, @@ -51654,6 +51098,7 @@ }, "node_modules/cookie": { "version": "0.4.2", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.6" @@ -72452,10 +71897,6 @@ "@types/unist": "*" } }, - "node_modules/lru_map": { - "version": "0.3.3", - "license": "MIT" - }, "node_modules/lru-cache": { "version": "5.1.1", "license": "ISC", @@ -89509,10 +88950,6 @@ "hasInstallScript": true, "license": "MIT" }, - "node_modules/redux-sentry-middleware": { - "version": "0.1.8", - "license": "MIT" - }, "node_modules/redux-thunk": { "version": "2.4.2", "license": "MIT", @@ -99140,57 +98577,6 @@ "node": ">=6" } }, - "node_modules/toucan-js": { - "version": "3.3.1", - "license": "MIT", - "dependencies": { - "@sentry/core": "7.76.0", - "@sentry/integrations": "7.76.0", - "@sentry/types": "7.76.0", - "@sentry/utils": "7.76.0" - } - }, - "node_modules/toucan-js/node_modules/@sentry/core": { - "version": "7.76.0", - "license": "MIT", - "dependencies": { - "@sentry/types": "7.76.0", - "@sentry/utils": "7.76.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/toucan-js/node_modules/@sentry/integrations": { - "version": "7.76.0", - "license": "MIT", - "dependencies": { - "@sentry/core": "7.76.0", - "@sentry/types": "7.76.0", - "@sentry/utils": "7.76.0", - "localforage": "^1.8.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/toucan-js/node_modules/@sentry/types": { - "version": "7.76.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/toucan-js/node_modules/@sentry/utils": { - "version": "7.76.0", - "license": "MIT", - "dependencies": { - "@sentry/types": "7.76.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/touch": { "version": "3.1.0", "dev": true, @@ -126430,7 +125816,6 @@ "@optimizely/optimizely-sdk": "4.6.0", "@sendgrid/client": "7.7.0", "@sendgrid/mail": "7.7.0", - "@sentry/node": "6.2.5", "@solana/buffer-layout": "4.0.1", "@solana/buffer-layout-utils": "0.2.0", "@solana/spl-token": "0.3.8", @@ -138750,7 +138135,6 @@ "@reown/appkit-adapter-solana": "1.7.1", "@reown/appkit-adapter-wagmi": "1.7.1", "@reown/appkit-wallet-button": "1.7.1", - "@sentry/browser": "^7.117.0", "@solana/spl-token": "0.3.8", "@solana/web3.js": "1.98.0", "@stripe/crypto": "0.0.4", @@ -138814,12 +138198,10 @@ "redux": "4.1.1", "redux-persist": "6.0.0", "redux-saga": "1.1.3", - "redux-sentry-middleware": "0.1.8", "redux-thunk": "2.4.2", "reselect": "4.0.0", "semver": "6.3.0", "tar": "6.1.11", - "toucan-js": "3.3.1", "type-fest": "4.26.1", "typed-redux-saga": "1.3.1", "typesafe-actions": "5.1.0", @@ -138858,7 +138240,6 @@ "@types/react-table": "7.7.12", "@types/react-twitter-auth": "0.0.4", "@types/react-virtualized": "9.21.21", - "@types/redux-sentry-middleware": "0.2.1", "@types/resize-observer-browser": "0.1.7", "@vitejs/plugin-react-swc": "4.2.2", "abort-controller": "3.0.0", diff --git a/package.json b/package.json index 3acbcf6cb42..820eecc361c 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,6 @@ }, "devDependencies": { "@emotion/eslint-plugin": "11.12.0", - "@sentry/cli": "3.1.0", "@tsconfig/strictest": "2.0.2", "@types/keyv": "4.2.0", "@types/react": "19.0.0", diff --git a/packages/common/src/api/tan-query/coins/useFanClubByTicker.ts b/packages/common/src/api/tan-query/coins/useFanClubByTicker.ts index 98a97d91cdb..269698ab01d 100644 --- a/packages/common/src/api/tan-query/coins/useFanClubByTicker.ts +++ b/packages/common/src/api/tan-query/coins/useFanClubByTicker.ts @@ -20,7 +20,7 @@ import { useFanClub, getFanClubQueryKey } from './useFanClub' /** * Function to check if a coin ticker is available for use. * Returns true if available, false if taken. - * Handles 404 errors gracefully without reporting them to Sentry. + * Swallows 404 errors so they are treated as "available". */ export const fetchCoinTickerAvailability = async ( ticker: string, diff --git a/packages/common/src/api/tan-query/coins/useRedeemCoin.ts b/packages/common/src/api/tan-query/coins/useRedeemCoin.ts index 49ce0e9aab9..392629c1aaf 100644 --- a/packages/common/src/api/tan-query/coins/useRedeemCoin.ts +++ b/packages/common/src/api/tan-query/coins/useRedeemCoin.ts @@ -1,7 +1,6 @@ import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' -import { Feature } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QUERY_KEYS } from '../queryKeys' @@ -15,7 +14,7 @@ type RedeemCoinParams = { } export const useRedeemCoin = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const { data: currentUserId } = useCurrentUserId() @@ -47,13 +46,8 @@ export const useRedeemCoin = () => { queryKey: getFanClubQueryKey(mint) }) }, - onError: (error: Error, args, _context) => { - reportToSentry({ - error, - additionalInfo: args, - name: 'RedeemCoin', - feature: Feature.FanClubs - }) + onError: (error: Error, _args, _context) => { + console.error(error) // Toast generic error message toast({ diff --git a/packages/common/src/api/tan-query/coins/useRedeemCoinCode.ts b/packages/common/src/api/tan-query/coins/useRedeemCoinCode.ts index e3c68c6b191..26ea104bb81 100644 --- a/packages/common/src/api/tan-query/coins/useRedeemCoinCode.ts +++ b/packages/common/src/api/tan-query/coins/useRedeemCoinCode.ts @@ -1,7 +1,6 @@ import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' -import { Feature } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QUERY_KEYS } from '../queryKeys' @@ -16,7 +15,7 @@ type RedeemCoinCodeParams = { } export const useRedeemCoinCode = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const { data: currentUserId } = useCurrentUserId() @@ -49,13 +48,8 @@ export const useRedeemCoinCode = () => { queryKey: getFanClubQueryKey(mint) }) }, - onError: (error: Error, args, _context) => { - reportToSentry({ - error, - additionalInfo: args, - name: 'RedeemCoinCode', - feature: Feature.FanClubs - }) + onError: (error: Error, _args, _context) => { + console.error(error) // TODO: Should 'Please try again' be added to the end of the message? // Toast generic error message diff --git a/packages/common/src/api/tan-query/collection/useDeleteCollection.ts b/packages/common/src/api/tan-query/collection/useDeleteCollection.ts index 3dfd339fae2..20a9bc17800 100644 --- a/packages/common/src/api/tan-query/collection/useDeleteCollection.ts +++ b/packages/common/src/api/tan-query/collection/useDeleteCollection.ts @@ -5,7 +5,6 @@ import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' import { useAppContext } from '~/context/appContext' import { Name } from '~/models/Analytics' -import { Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { accountActions } from '~/store' @@ -25,7 +24,7 @@ type MutationContext = { } export const useDeleteCollection = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() const { data: currentUserId } = useCurrentUserId() @@ -88,7 +87,7 @@ export const useDeleteCollection = () => { return { previousCollection } }, - onError: (error, { collectionId }, context?: MutationContext) => { + onError: (error, _args, context?: MutationContext) => { // Roll back optimistic updates if the mutation fails if (context?.previousCollection) { const collection = context.previousCollection @@ -101,14 +100,7 @@ export const useDeleteCollection = () => { }) } - reportToSentry({ - error, - additionalInfo: { - collectionId - }, - feature: Feature.Edit, - name: 'Delete Collection' - }) + console.error(error) }, onSuccess: async (_, { collectionId }) => { // Invalidate and refetch collection queries to ensure cache consistency diff --git a/packages/common/src/api/tan-query/comments/useComment.ts b/packages/common/src/api/tan-query/comments/useComment.ts index 2f6a17018cc..7b9c5233f95 100644 --- a/packages/common/src/api/tan-query/comments/useComment.ts +++ b/packages/common/src/api/tan-query/comments/useComment.ts @@ -6,14 +6,14 @@ import { useDispatch } from 'react-redux' import { commentFromSDK } from '~/adapters' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { messages } from './types' import { getCommentQueryKey } from './utils' export const useComment = (commentId: ID | null | undefined) => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const dispatch = useDispatch() const queryRes = useQuery({ @@ -36,14 +36,10 @@ export const useComment = (commentId: ID | null | undefined) => { useEffect(() => { if (error) { - reportToSentry({ - error, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) dispatch(toast({ content: messages.loadError('comments') })) } - }, [error, dispatch, reportToSentry]) + }, [error, dispatch]) return queryRes } diff --git a/packages/common/src/api/tan-query/comments/useCommentReplies.ts b/packages/common/src/api/tan-query/comments/useCommentReplies.ts index 509facc7af8..728ca6bfd32 100644 --- a/packages/common/src/api/tan-query/comments/useCommentReplies.ts +++ b/packages/common/src/api/tan-query/comments/useCommentReplies.ts @@ -6,7 +6,7 @@ import { useDispatch } from 'react-redux' import { replyCommentFromSDK, transformAndCleanList } from '~/adapters' import { useQueryContext } from '~/api/tan-query/utils' -import { Comment, Feature, ID } from '~/models' +import { Comment, ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QueryOptions } from '../types' @@ -27,7 +27,7 @@ export const useCommentReplies = ( { commentId, pageSize = COMMENT_REPLIES_PAGE_SIZE }: GetRepliesArgs, options?: QueryOptions ) => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() const startingLimit = 3 // comments will load in with 3 already so we don't start pagination at 0 @@ -80,14 +80,10 @@ export const useCommentReplies = ( useEffect(() => { if (error) { - reportToSentry({ - error, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) dispatch(toast({ content: messages.loadError('replies') })) } - }, [error, dispatch, reportToSentry]) + }, [error, dispatch]) const { data: replies } = useComments(replyIds) diff --git a/packages/common/src/api/tan-query/comments/useDeleteComment.ts b/packages/common/src/api/tan-query/comments/useDeleteComment.ts index eaab048aed7..499d7d8dca1 100644 --- a/packages/common/src/api/tan-query/comments/useDeleteComment.ts +++ b/packages/common/src/api/tan-query/comments/useDeleteComment.ts @@ -4,7 +4,7 @@ import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' -import { Comment, Feature, ID, ReplyComment } from '~/models' +import { Comment, ID, ReplyComment } from '~/models' import { toast } from '~/store/ui/toast/slice' import { messages } from './types' @@ -23,7 +23,7 @@ export type DeleteCommentArgs = { } export const useDeleteComment = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() return useMutation({ @@ -100,12 +100,7 @@ export const useDeleteComment = () => { onError: (error: Error, args) => { const { trackId, currentSort } = args - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) // Toast standard error message dispatch(toast({ content: messages.mutationError('deleting') })) // Since this mutation handles sort data, its difficult to undo the optimistic update so we just re-load everything diff --git a/packages/common/src/api/tan-query/comments/useDeleteTextPost.ts b/packages/common/src/api/tan-query/comments/useDeleteTextPost.ts index f0e6faef09d..ceee8c06e73 100644 --- a/packages/common/src/api/tan-query/comments/useDeleteTextPost.ts +++ b/packages/common/src/api/tan-query/comments/useDeleteTextPost.ts @@ -4,7 +4,7 @@ import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { FanClubFeedItem, getFanClubFeedQueryKey } from './useFanClubFeed' @@ -18,7 +18,7 @@ export type DeleteTextPostArgs = { } export const useDeleteTextPost = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() return useMutation({ @@ -60,12 +60,7 @@ export const useDeleteTextPost = () => { }) }, onError: (error: Error, args) => { - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) dispatch(toast({ content: 'There was an error deleting the post.' })) // Reset to server state queryClient.invalidateQueries({ diff --git a/packages/common/src/api/tan-query/comments/useEditComment.ts b/packages/common/src/api/tan-query/comments/useEditComment.ts index e8f15d60b65..86da25874c7 100644 --- a/packages/common/src/api/tan-query/comments/useEditComment.ts +++ b/packages/common/src/api/tan-query/comments/useEditComment.ts @@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { CommentOrReply, messages } from './types' @@ -20,7 +20,7 @@ export type EditCommentArgs = { } export const useEditComment = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() return useMutation({ @@ -62,12 +62,7 @@ export const useEditComment = () => { }, onError: (error: Error, args, context) => { const { commentId } = args - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) // Toast standard error message dispatch(toast({ content: messages.mutationError('editing') })) diff --git a/packages/common/src/api/tan-query/comments/useEventComments.ts b/packages/common/src/api/tan-query/comments/useEventComments.ts index b1c8147cb2c..6f1bc7dba70 100644 --- a/packages/common/src/api/tan-query/comments/useEventComments.ts +++ b/packages/common/src/api/tan-query/comments/useEventComments.ts @@ -6,7 +6,7 @@ import { useDispatch } from 'react-redux' import { commentFromSDK } from '~/adapters' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QUERY_KEYS } from '../queryKeys' @@ -54,7 +54,7 @@ export const useEventComments = ({ pageSize = EVENT_COMMENTS_PAGE_SIZE, enabled = true }: UseEventCommentsArgs) => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() const { data: currentUserId } = useCurrentUserId() @@ -100,11 +100,7 @@ export const useEventComments = ({ useEffect(() => { if (error) { - reportToSentry({ - error, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) dispatch( toast({ content: @@ -112,7 +108,7 @@ export const useEventComments = ({ }) ) } - }, [error, dispatch, reportToSentry]) + }, [error, dispatch]) return queryRes } diff --git a/packages/common/src/api/tan-query/comments/useFanClubFeed.ts b/packages/common/src/api/tan-query/comments/useFanClubFeed.ts index 6440ee73299..6e8fbafa707 100644 --- a/packages/common/src/api/tan-query/comments/useFanClubFeed.ts +++ b/packages/common/src/api/tan-query/comments/useFanClubFeed.ts @@ -6,7 +6,7 @@ import { useDispatch } from 'react-redux' import { commentFromSDK } from '~/adapters' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QUERY_KEYS } from '../queryKeys' @@ -46,7 +46,7 @@ export const useFanClubFeed = ({ pageSize = FAN_CLUB_FEED_PAGE_SIZE, enabled = true }: UseFanClubFeedArgs) => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() const { data: currentUserId } = useCurrentUserId() @@ -99,18 +99,14 @@ export const useFanClubFeed = ({ useEffect(() => { if (error) { - reportToSentry({ - error, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) dispatch( toast({ content: 'There was an error loading the feed. Please try again.' }) ) } - }, [error, dispatch, reportToSentry]) + }, [error, dispatch]) return queryRes } diff --git a/packages/common/src/api/tan-query/comments/useMuteUser.ts b/packages/common/src/api/tan-query/comments/useMuteUser.ts index 5fd789795bb..94ef3047b7c 100644 --- a/packages/common/src/api/tan-query/comments/useMuteUser.ts +++ b/packages/common/src/api/tan-query/comments/useMuteUser.ts @@ -3,7 +3,7 @@ import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' -import { Comment, Feature, ID } from '~/models' +import { Comment, ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { messages } from './types' @@ -22,7 +22,7 @@ export type MuteUserArgs = { } export const useMuteUser = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() @@ -94,12 +94,7 @@ export const useMuteUser = () => { }, onError: (error: Error, args) => { const { trackId, currentSort } = args - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) // Generic toast error dispatch(toast({ content: messages.muteUserError })) diff --git a/packages/common/src/api/tan-query/comments/usePinComment.ts b/packages/common/src/api/tan-query/comments/usePinComment.ts index b59c8acd111..23766ee67ed 100644 --- a/packages/common/src/api/tan-query/comments/usePinComment.ts +++ b/packages/common/src/api/tan-query/comments/usePinComment.ts @@ -4,7 +4,7 @@ import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { Nullable } from '~/utils' @@ -23,7 +23,7 @@ export type PinCommentArgs = { } export const usePinComment = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() return useMutation({ @@ -88,12 +88,7 @@ export const usePinComment = () => { }, onError: (error: Error, args) => { const { trackId, currentSort, previousPinnedCommentId } = args - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) // Toast standard error message dispatch(toast({ content: messages.mutationError('pinning') })) queryClient.setQueryData( diff --git a/packages/common/src/api/tan-query/comments/usePostComment.ts b/packages/common/src/api/tan-query/comments/usePostComment.ts index f068348d38a..7048bccdffc 100644 --- a/packages/common/src/api/tan-query/comments/usePostComment.ts +++ b/packages/common/src/api/tan-query/comments/usePostComment.ts @@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' import { useQueryContext } from '~/api/tan-query/utils' -import { Comment, Feature, ID } from '~/models' +import { Comment, ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { @@ -26,7 +26,7 @@ export type PostCommentArgs = { } export const usePostComment = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() return useMutation({ @@ -113,12 +113,7 @@ export const usePostComment = () => { }, onError: (error: Error, args) => { const { trackId, currentSort } = args - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) // Undo comment count change subtractCommentCount(queryClient, trackId) // Toast generic error message diff --git a/packages/common/src/api/tan-query/comments/usePostEventComment.ts b/packages/common/src/api/tan-query/comments/usePostEventComment.ts index 0a7242d67e6..9fe45937f52 100644 --- a/packages/common/src/api/tan-query/comments/usePostEventComment.ts +++ b/packages/common/src/api/tan-query/comments/usePostEventComment.ts @@ -2,7 +2,7 @@ import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { useQueryContext } from '~/api/tan-query/utils' -import { Comment, Feature, ID } from '~/models' +import { Comment, ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QUERY_KEYS } from '../queryKeys' @@ -31,7 +31,7 @@ export type PostEventCommentArgs = { * the event's owner, so there's no client-side branching here. */ export const usePostEventComment = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() return useMutation({ @@ -153,12 +153,7 @@ export const usePostEventComment = () => { // "I pressed send and it disappeared" experience. Mirrors how the // track-comment hook (usePostComment) handles success. onError: (error: Error, args) => { - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) toast({ content: 'There was an error posting your comment. Please try again.' }) diff --git a/packages/common/src/api/tan-query/comments/usePostTextUpdate.ts b/packages/common/src/api/tan-query/comments/usePostTextUpdate.ts index 4aed18ed4fd..53aa1ceebf6 100644 --- a/packages/common/src/api/tan-query/comments/usePostTextUpdate.ts +++ b/packages/common/src/api/tan-query/comments/usePostTextUpdate.ts @@ -2,7 +2,7 @@ import { Id } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { useQueryContext } from '~/api/tan-query/utils' -import { Comment, Feature, ID } from '~/models' +import { Comment, ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { getFanClubFeedQueryKey } from './useFanClubFeed' @@ -18,7 +18,7 @@ export type PostTextUpdateArgs = { } export const usePostTextUpdate = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() return useMutation({ @@ -93,12 +93,7 @@ export const usePostTextUpdate = () => { }) }, onError: (error: Error, args) => { - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) toast({ content: 'There was an error posting your update. Please try again.' }) diff --git a/packages/common/src/api/tan-query/comments/useReactToComment.ts b/packages/common/src/api/tan-query/comments/useReactToComment.ts index bd891a92e26..24bcd5ff0c3 100644 --- a/packages/common/src/api/tan-query/comments/useReactToComment.ts +++ b/packages/common/src/api/tan-query/comments/useReactToComment.ts @@ -7,7 +7,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { CommentOrReply, messages } from './types' @@ -24,7 +24,7 @@ export type ReactToCommentArgs = { } export const useReactToComment = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() return useMutation({ @@ -81,12 +81,7 @@ export const useReactToComment = () => { }, onError: (error: Error, args, context) => { const { commentId } = args - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) // Toast standard error message dispatch(toast({ content: messages.mutationError('reacting to') })) diff --git a/packages/common/src/api/tan-query/comments/useReportComment.ts b/packages/common/src/api/tan-query/comments/useReportComment.ts index cfe0d94f9d2..642993b156f 100644 --- a/packages/common/src/api/tan-query/comments/useReportComment.ts +++ b/packages/common/src/api/tan-query/comments/useReportComment.ts @@ -4,7 +4,7 @@ import { cloneDeep } from 'lodash' import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' -import { Comment, Feature, ID, ReplyComment } from '~/models' +import { Comment, ID, ReplyComment } from '~/models' import { toast } from '~/store/ui/toast/slice' import { messages } from './types' @@ -23,7 +23,7 @@ export type ReportCommentArgs = { } export const useReportComment = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() return useMutation({ @@ -76,12 +76,7 @@ export const useReportComment = () => { }, onError: (error: Error, args) => { const { trackId, currentSort } = args - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) // Generic toast error dispatch(toast({ content: messages.mutationError('reporting') })) diff --git a/packages/common/src/api/tan-query/comments/useTrackComments.ts b/packages/common/src/api/tan-query/comments/useTrackComments.ts index aa91c56d2c5..a6872592c7d 100644 --- a/packages/common/src/api/tan-query/comments/useTrackComments.ts +++ b/packages/common/src/api/tan-query/comments/useTrackComments.ts @@ -10,7 +10,7 @@ import { useDispatch } from 'react-redux' import { commentFromSDK, transformAndCleanList } from '~/adapters' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QueryOptions } from '../types' @@ -36,7 +36,7 @@ export const useTrackComments = ( }: GetCommentsByTrackArgs, options?: QueryOptions ) => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const isMutating = useIsMutating() const queryClient = useQueryClient() const dispatch = useDispatch() @@ -83,14 +83,10 @@ export const useTrackComments = ( useEffect(() => { if (error) { - reportToSentry({ - error, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) dispatch(toast({ content: messages.loadError('comments') })) } - }, [error, dispatch, reportToSentry]) + }, [error, dispatch]) const { data: comments } = useComments(commentIds) diff --git a/packages/common/src/api/tan-query/comments/useUpdateCommentNotificationSetting.ts b/packages/common/src/api/tan-query/comments/useUpdateCommentNotificationSetting.ts index ad2b6dd400b..f81ebfbfae6 100644 --- a/packages/common/src/api/tan-query/comments/useUpdateCommentNotificationSetting.ts +++ b/packages/common/src/api/tan-query/comments/useUpdateCommentNotificationSetting.ts @@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { CommentOrReply, messages } from './types' @@ -16,7 +16,7 @@ export type UpdateCommentNotificationSettingArgs = { } export const useUpdateCommentNotificationSetting = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() return useMutation({ @@ -46,12 +46,7 @@ export const useUpdateCommentNotificationSetting = () => { }, onError: (error: Error, args) => { const { commentId } = args - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) dispatch( toast({ content: messages.updateCommentNotificationSettingError }) ) diff --git a/packages/common/src/api/tan-query/comments/useUpdateTrackCommentNotificationSetting.ts b/packages/common/src/api/tan-query/comments/useUpdateTrackCommentNotificationSetting.ts index e14fbfde506..e8d00273951 100644 --- a/packages/common/src/api/tan-query/comments/useUpdateTrackCommentNotificationSetting.ts +++ b/packages/common/src/api/tan-query/comments/useUpdateTrackCommentNotificationSetting.ts @@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { messages } from './types' @@ -15,7 +15,7 @@ export type UpdateTrackCommentNotificationSettingArgs = { } export const useUpdateTrackCommentNotificationSetting = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() @@ -38,12 +38,7 @@ export const useUpdateTrackCommentNotificationSetting = () => { }, onError: (error: Error, args) => { const { trackId } = args - reportToSentry({ - error, - additionalInfo: args, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) dispatch(toast({ content: messages.muteUserError })) queryClient.resetQueries({ diff --git a/packages/common/src/api/tan-query/comments/useUserComments.ts b/packages/common/src/api/tan-query/comments/useUserComments.ts index 3b4f5652936..81255eef905 100644 --- a/packages/common/src/api/tan-query/comments/useUserComments.ts +++ b/packages/common/src/api/tan-query/comments/useUserComments.ts @@ -10,7 +10,7 @@ import { useDispatch } from 'react-redux' import { commentFromSDK, transformAndCleanList } from '~/adapters' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QueryOptions } from '../types' @@ -31,7 +31,7 @@ export const useUserComments = ( }, options?: QueryOptions ) => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const { data: currentUserId } = useCurrentUserId() const isMutating = useIsMutating() const queryClient = useQueryClient() @@ -75,14 +75,10 @@ export const useUserComments = ( useEffect(() => { if (error) { - reportToSentry({ - error, - name: 'Comments', - feature: Feature.Comments - }) + console.error(error) dispatch(toast({ content: messages.loadError('comments') })) } - }, [error, dispatch, reportToSentry]) + }, [error, dispatch]) const { data: comments } = useComments(commentIds) diff --git a/packages/common/src/api/tan-query/events/useCreateEvent.ts b/packages/common/src/api/tan-query/events/useCreateEvent.ts index 68ab0c4877d..7b70b18543e 100644 --- a/packages/common/src/api/tan-query/events/useCreateEvent.ts +++ b/packages/common/src/api/tan-query/events/useCreateEvent.ts @@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' import { useQueryContext } from '~/api/tan-query/utils' -import { Event, Feature, ID } from '~/models' +import { Event, ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QUERY_KEYS } from '../queryKeys' @@ -21,7 +21,7 @@ export type CreateEventArgs = { } export const useCreateEvent = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() return useMutation({ @@ -87,12 +87,7 @@ export const useCreateEvent = () => { return { prevEntityState, prevEventTypeState } }, onError: (error: Error, args, context) => { - reportToSentry({ - error, - additionalInfo: args, - name: 'Events', - feature: Feature.Events - }) + console.error(error) // Revert the optimistic updates queryClient.resetQueries({ diff --git a/packages/common/src/api/tan-query/events/useDeleteEvent.ts b/packages/common/src/api/tan-query/events/useDeleteEvent.ts index d5a3278e07a..3fae7299d16 100644 --- a/packages/common/src/api/tan-query/events/useDeleteEvent.ts +++ b/packages/common/src/api/tan-query/events/useDeleteEvent.ts @@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { cloneDeep } from 'lodash' import { useQueryContext } from '~/api/tan-query/utils' -import { Event, Feature, ID } from '~/models' +import { Event, ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { getEventQueryKey, getEventIdsByEntityIdQueryKey } from './utils' @@ -13,7 +13,7 @@ export type DeleteEventArgs = { } export const useDeleteEvent = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() return useMutation({ @@ -111,12 +111,7 @@ export const useDeleteEvent = () => { ) } - reportToSentry({ - error, - additionalInfo: args, - name: 'Events', - feature: Feature.Events - }) + console.error(error) toast({ content: 'There was an error deleting the event. Please try again' diff --git a/packages/common/src/api/tan-query/events/useEventFollowers.ts b/packages/common/src/api/tan-query/events/useEventFollowers.ts index 73574dff4e4..036d12644ec 100644 --- a/packages/common/src/api/tan-query/events/useEventFollowers.ts +++ b/packages/common/src/api/tan-query/events/useEventFollowers.ts @@ -3,7 +3,7 @@ import { useQuery, useQueryClient } from '@tanstack/react-query' import { userMetadataListFromSDK } from '~/adapters/user' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { QUERY_KEYS } from '../queryKeys' import { QueryKey, QueryOptions } from '../types' @@ -34,7 +34,7 @@ export const useEventFollowers = ( { eventId, limit = DEFAULT_LIMIT }: UseEventFollowersArgs, options?: QueryOptions ) => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const { data: currentUserId } = useCurrentUserId() const queryClient = useQueryClient() @@ -54,11 +54,7 @@ export const useEventFollowers = ( if (users.length) primeUserData({ users, queryClient }) return users.map((u) => u.user_id) } catch (error) { - reportToSentry({ - error: error as Error, - name: 'Events', - feature: Feature.Events - }) + console.error('Events', error as Error) return [] } }, diff --git a/packages/common/src/api/tan-query/events/useFollowEvent.ts b/packages/common/src/api/tan-query/events/useFollowEvent.ts index 6e549a9de0a..b1e3e38324a 100644 --- a/packages/common/src/api/tan-query/events/useFollowEvent.ts +++ b/packages/common/src/api/tan-query/events/useFollowEvent.ts @@ -2,7 +2,7 @@ import { encodeHashId } from '@audius/sdk' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature, ID } from '~/models' +import { ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QUERY_KEYS } from '../queryKeys' @@ -65,7 +65,7 @@ export const useEventFollowState = (eventId: ID | null | undefined) => { } export const useFollowEvent = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() return useMutation({ @@ -96,11 +96,7 @@ export const useFollowEvent = () => { getEventFollowStateQueryKey(eventId, userId), ctx?.prev ?? { isFollowed: false, followerCount: 0 } ) - reportToSentry({ - error, - name: 'Events', - feature: Feature.Events - }) + console.error(error) toast({ content: 'Could not follow contest. Please try again.' }) }, onSettled: (_data, _err, { userId, eventId }) => { @@ -117,7 +113,7 @@ export const useFollowEvent = () => { } export const useUnfollowEvent = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() return useMutation({ @@ -142,11 +138,7 @@ export const useUnfollowEvent = () => { getEventFollowStateQueryKey(eventId, userId), ctx?.prev ?? { isFollowed: true, followerCount: 0 } ) - reportToSentry({ - error, - name: 'Events', - feature: Feature.Events - }) + console.error(error) toast({ content: 'Could not unfollow contest. Please try again.' }) }, onSettled: (_data, _err, { userId, eventId }) => { diff --git a/packages/common/src/api/tan-query/events/useUpdateEvent.ts b/packages/common/src/api/tan-query/events/useUpdateEvent.ts index 3ff305ef47c..0694a48e4f7 100644 --- a/packages/common/src/api/tan-query/events/useUpdateEvent.ts +++ b/packages/common/src/api/tan-query/events/useUpdateEvent.ts @@ -2,7 +2,7 @@ import { EventEntityTypeEnum, EventEventTypeEnum } from '@audius/sdk' import { useMutation, useQueryClient } from '@tanstack/react-query' import { useQueryContext } from '~/api/tan-query/utils' -import { Event, Feature, ID } from '~/models' +import { Event, ID } from '~/models' import { toast } from '~/store/ui/toast/slice' import { QUERY_KEYS } from '../queryKeys' @@ -20,7 +20,7 @@ export type UpdateEventArgs = { } export const useUpdateEvent = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() return useMutation({ @@ -53,12 +53,7 @@ export const useUpdateEvent = () => { return { previousEvent: currentEvent } }, onError: (error: Error, args, context) => { - reportToSentry({ - error, - additionalInfo: args, - name: 'Events', - feature: Feature.Events - }) + console.error(error) // Revert the optimistic updates if (context?.previousEvent) { diff --git a/packages/common/src/api/tan-query/jupiter/useSwapCoins.ts b/packages/common/src/api/tan-query/jupiter/useSwapCoins.ts index 867ffb437d0..d2757271115 100644 --- a/packages/common/src/api/tan-query/jupiter/useSwapCoins.ts +++ b/packages/common/src/api/tan-query/jupiter/useSwapCoins.ts @@ -13,7 +13,6 @@ import { } from '~/api' import { QUERY_KEYS } from '~/api/tan-query/queryKeys' import type { QueryContextType } from '~/api/tan-query/utils/QueryContext' -import { Feature } from '~/models' import { FollowSource } from '~/models/Analytics' import type { User } from '~/models/User' import { JupiterQuoteResult } from '~/services/Jupiter' @@ -230,15 +229,13 @@ const autoFollowArtistOnCoinPurchase = async ({ queryClient, audiusSdk, dispatch, - followUser, - reportToSentry + followUser }: { outputMint: string queryClient: ReturnType audiusSdk: QueryContextType['audiusSdk'] dispatch: ReturnType followUser: ReturnType['mutate'] - reportToSentry: QueryContextType['reportToSentry'] }) => { if (!outputMint || NON_FAN_CLUB_MINTS.includes(outputMint)) { return @@ -275,12 +272,7 @@ const autoFollowArtistOnCoinPurchase = async ({ source: FollowSource.OVERFLOW }) } catch (error) { - reportToSentry({ - name: 'AutoFollowArtistOnCoinPurchaseError', - error: error as Error, - feature: Feature.TanQuery, - additionalInfo: { outputMint } - }) + console.error('AutoFollowArtistOnCoinPurchaseError', error as Error) } } @@ -290,8 +282,7 @@ const autoFollowArtistOnCoinPurchase = async ({ */ export const useSwapCoins = () => { const queryClient = useQueryClient() - const { solanaWalletService, reportToSentry, audiusSdk, env } = - useQueryContext() + const { solanaWalletService, audiusSdk, env } = useQueryContext() const { data: user } = useCurrentAccountUser() const { coins } = useTradeableCoins() const dispatch = useDispatch() @@ -334,18 +325,17 @@ export const useSwapCoins = () => { errorStage = result.errorStage } - reportToSentry({ - name: `JupiterSwap${result.errorStage || errorStage}Error`, - error: new Error(result.error?.message || 'Unknown swap error'), - feature: Feature.TanQuery, - additionalInfo: { + console.error( + `JupiterSwap${result.errorStage || errorStage}Error`, + new Error(result.error?.message || 'Unknown swap error'), + { params, signature, errorStage: result.errorStage || errorStage, firstQuoteResponse: firstQuoteResult?.quote, secondQuoteResponse: secondQuoteResult?.quote } - }) + ) // Throw error so React Query calls onError instead of onSuccess throw new Error(result.error?.message || 'Swap failed') @@ -353,17 +343,12 @@ export const useSwapCoins = () => { return result } catch (error: unknown) { - reportToSentry({ - name: `JupiterSwap${errorStage}Error`, - error: error as Error, - feature: Feature.TanQuery, - additionalInfo: { - params, - signature, - errorStage, - firstQuoteResponse: firstQuoteResult?.quote, - secondQuoteResponse: secondQuoteResult?.quote - } + console.error(`JupiterSwap${errorStage}Error`, error, { + params, + signature, + errorStage, + firstQuoteResponse: firstQuoteResult?.quote, + secondQuoteResponse: secondQuoteResult?.quote }) return getSwapErrorResponse({ @@ -383,8 +368,7 @@ export const useSwapCoins = () => { queryClient, audiusSdk, dispatch, - followUser, - reportToSentry + followUser }) }, onMutate: () => { diff --git a/packages/common/src/api/tan-query/tracks/useDeleteTrack.ts b/packages/common/src/api/tan-query/tracks/useDeleteTrack.ts index acf8cd3be1b..d873ed25e1c 100644 --- a/packages/common/src/api/tan-query/tracks/useDeleteTrack.ts +++ b/packages/common/src/api/tan-query/tracks/useDeleteTrack.ts @@ -4,7 +4,6 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { useQueryContext } from '~/api/tan-query/utils' import { useAppContext } from '~/context/appContext' import { Name } from '~/models/Analytics' -import { Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { Track } from '~/models/Track' import { UserMetadata } from '~/models/User' @@ -27,7 +26,7 @@ type MutationContext = { } export const useDeleteTrack = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const { data: currentUserId } = useCurrentUserId() const { data: currentUser } = useUser(currentUserId) @@ -134,12 +133,7 @@ export const useDeleteTrack = () => { }) } - reportToSentry({ - error, - additionalInfo: { trackId }, - name: 'Delete Track', - feature: Feature.Edit - }) + console.error(error) } }) } diff --git a/packages/common/src/api/tan-query/tracks/useDownloadTrackStems.ts b/packages/common/src/api/tan-query/tracks/useDownloadTrackStems.ts index 1b402577157..ea3d4424e70 100644 --- a/packages/common/src/api/tan-query/tracks/useDownloadTrackStems.ts +++ b/packages/common/src/api/tan-query/tracks/useDownloadTrackStems.ts @@ -2,7 +2,6 @@ import { Id } from '@audius/sdk' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { useQueryContext } from '~/api/tan-query/utils' -import { Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { QUERY_KEYS } from '../queryKeys' @@ -39,7 +38,7 @@ export const getDownloadTrackStemsQueryKey = (trackId: ID) => { } export const useDownloadTrackStems = ({ trackId }: { trackId: ID }) => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const { data: currentUserId } = useCurrentUserId() @@ -76,11 +75,7 @@ export const useDownloadTrackStems = ({ trackId }: { trackId: ID }) => { ) }, onError: (error) => { - reportToSentry({ - error, - name: 'Failed to initiate stems archive download', - feature: Feature.Remixes - }) + console.error(error) } }) } diff --git a/packages/common/src/api/tan-query/tracks/useFavoriteTrack.ts b/packages/common/src/api/tan-query/tracks/useFavoriteTrack.ts index 7ff9c3197f2..61cab5a2172 100644 --- a/packages/common/src/api/tan-query/tracks/useFavoriteTrack.ts +++ b/packages/common/src/api/tan-query/tracks/useFavoriteTrack.ts @@ -5,7 +5,6 @@ import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' import { useAppContext } from '~/context/appContext' import { Name } from '~/models/Analytics' -import { Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { Track } from '~/models/Track' import { accountActions } from '~/store/account' @@ -23,7 +22,7 @@ type FavoriteTrackArgs = { } export const useFavoriteTrack = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() const { data: currentUserId } = useCurrentUserId() @@ -151,7 +150,7 @@ export const useFavoriteTrack = () => { // Dispatch the saveTrackSucceeded action dispatch(tracksSocialActions.saveTrackSucceeded(trackId)) }, - onError: (error, { trackId }, context) => { + onError: (error, _args, context) => { if (!context) return // Revert optimistic updates @@ -162,12 +161,7 @@ export const useFavoriteTrack = () => { }) dispatch(accountActions.decrementTrackSaveCount()) - reportToSentry({ - error, - additionalInfo: { trackId }, - name: 'Favorite Track', - feature: Feature.Social - }) + console.error(error) } }) } diff --git a/packages/common/src/api/tan-query/tracks/useUnfavoriteTrack.ts b/packages/common/src/api/tan-query/tracks/useUnfavoriteTrack.ts index bb5ec596285..e741cee2594 100644 --- a/packages/common/src/api/tan-query/tracks/useUnfavoriteTrack.ts +++ b/packages/common/src/api/tan-query/tracks/useUnfavoriteTrack.ts @@ -5,7 +5,6 @@ import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' import { useAppContext } from '~/context/appContext' import { Name } from '~/models/Analytics' -import { Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { Track } from '~/models/Track' import { accountActions } from '~/store/account' @@ -25,7 +24,7 @@ export type UnfavoriteTrackArgs = { } export const useUnfavoriteTrack = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() const { data: currentUserId } = useCurrentUserId() @@ -122,7 +121,7 @@ export const useUnfavoriteTrack = () => { onSuccess: async (_, { trackId }) => { dispatch(tracksSocialActions.unsaveTrackSucceeded(trackId)) }, - onError: (error, { trackId }, context) => { + onError: (error, _args, context) => { if (!context) return // Revert optimistic updates @@ -133,12 +132,7 @@ export const useUnfavoriteTrack = () => { }) dispatch(accountActions.incrementTrackSaveCount()) - reportToSentry({ - error, - additionalInfo: { trackId }, - name: 'Unfavorite Track', - feature: Feature.Social - }) + console.error(error) } }) } diff --git a/packages/common/src/api/tan-query/tracks/useUpdateTrack.ts b/packages/common/src/api/tan-query/tracks/useUpdateTrack.ts index 2e6a77c1c4f..ee0f491b272 100644 --- a/packages/common/src/api/tan-query/tracks/useUpdateTrack.ts +++ b/packages/common/src/api/tan-query/tracks/useUpdateTrack.ts @@ -10,7 +10,6 @@ import { trackMetadataForUploadToSdk } from '~/adapters/track' import { useQueryContext } from '~/api/tan-query/utils' import { Track, UserTrackMetadata } from '~/models' import { Name } from '~/models/Analytics' -import { Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { TrackAccessType, @@ -103,7 +102,7 @@ const applyEditTrackFormatting = ( } export const useUpdateTrack = () => { - const { audiusSdk, reportToSentry, analytics } = useQueryContext() + const { audiusSdk, analytics } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() const store = useStore() @@ -148,12 +147,7 @@ export const useUpdateTrack = () => { ethAddress, recordAnalytics: analytics.track }).catch((error) => { - reportToSentry({ - error, - additionalInfo: { trackId, userId, ethAddress }, - feature: Feature.Edit, - name: 'Ensure USDC userbank on track edit' - }) + console.error(error) }) } @@ -334,7 +328,7 @@ export const useUpdateTrack = () => { ) } }, - onError: (error, { trackId, metadata }, context?: MutationContext) => { + onError: (error, { trackId }, context?: MutationContext) => { // If the mutation fails, roll back track data if (context?.previousTrack) { primeTrackData({ @@ -370,16 +364,7 @@ export const useUpdateTrack = () => { }) ) - reportToSentry({ - error, - additionalInfo: { - trackId, - userId, - metadata - }, - feature: Feature.Edit, - name: 'Edit Track' - }) + console.error(error) } }) } diff --git a/packages/common/src/api/tan-query/upload/usePublishCollection.ts b/packages/common/src/api/tan-query/upload/usePublishCollection.ts index 12a7bd0d3e1..f4f51089dd2 100644 --- a/packages/common/src/api/tan-query/upload/usePublishCollection.ts +++ b/packages/common/src/api/tan-query/upload/usePublishCollection.ts @@ -34,7 +34,7 @@ import { type PublishCollectionContext = Pick< QueryContextType, - 'audiusSdk' | 'analytics' | 'dispatch' | 'reportToSentry' + 'audiusSdk' | 'analytics' | 'dispatch' > & { userId: number } @@ -139,7 +139,7 @@ const getPublishCollectionOptions = (context: PublishCollectionContext) => export const usePublishCollection = ( options?: Partial> ) => { - const { audiusSdk, analytics, reportToSentry } = useQueryContext() + const { audiusSdk, analytics } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() const { data: account = null } = useCurrentAccount() @@ -152,8 +152,7 @@ export const usePublishCollection = ( audiusSdk, userId: userId!, dispatch, - analytics, - reportToSentry + analytics }), onSuccess: async (playlist) => { diff --git a/packages/common/src/api/tan-query/upload/usePublishStems.ts b/packages/common/src/api/tan-query/upload/usePublishStems.ts index 7437cacad5e..29a09705d4f 100644 --- a/packages/common/src/api/tan-query/upload/usePublishStems.ts +++ b/packages/common/src/api/tan-query/upload/usePublishStems.ts @@ -15,7 +15,7 @@ const { updateProgress } = uploadActions type PublishStemsContext = Pick< QueryContextType, - 'audiusSdk' | 'analytics' | 'dispatch' | 'reportToSentry' + 'audiusSdk' | 'analytics' | 'dispatch' > & { userId: number } diff --git a/packages/common/src/api/tan-query/upload/usePublishTracks.ts b/packages/common/src/api/tan-query/upload/usePublishTracks.ts index c34440e3f8c..3c5295d1a7f 100644 --- a/packages/common/src/api/tan-query/upload/usePublishTracks.ts +++ b/packages/common/src/api/tan-query/upload/usePublishTracks.ts @@ -5,8 +5,7 @@ import { trackMetadataForUploadToSdk } from '~/adapters' import { isContentUSDCPurchaseGated, type USDCPurchaseConditions, - Name, - Feature + Name } from '~/models' import { createUserBankIfNeeded } from '~/services/audius-backend' import { ProgressStatus, uploadActions } from '~/store' @@ -26,7 +25,7 @@ const { updateProgress } = uploadActions type PublishTracksContext = Pick< QueryContextType, - 'audiusSdk' | 'analytics' | 'dispatch' | 'reportToSentry' + 'audiusSdk' | 'analytics' | 'dispatch' > & { userId: number ethAddress?: string | null @@ -51,7 +50,6 @@ export const publishTracks = async ( kind, audiusSdk, dispatch, - reportToSentry, analytics: { make, track } } = context @@ -74,12 +72,7 @@ export const publishTracks = async ( ethAddress, recordAnalytics: track }).catch((error) => { - reportToSentry({ - error, - additionalInfo: { userId, ethAddress }, - feature: Feature.Upload, - name: 'Ensure USDC userbank on track upload' - }) + console.error(error) }) } @@ -147,11 +140,7 @@ export const publishTracks = async ( progress: { status: ProgressStatus.ERROR } }) ) - reportToSentry({ - error: e as Error, - name: 'Upload: Track Publish', - feature: Feature.Upload - }) + console.error('Upload: Track Publish', e as Error) console.error('Error publishing track:', e) return { result: null, error: e as Error } } diff --git a/packages/common/src/api/tan-query/upload/useUpload.ts b/packages/common/src/api/tan-query/upload/useUpload.ts index a05e5ddedc1..54dcaf50307 100644 --- a/packages/common/src/api/tan-query/upload/useUpload.ts +++ b/packages/common/src/api/tan-query/upload/useUpload.ts @@ -4,12 +4,7 @@ import { HashId, type UploadTrackFilesTask } from '@audius/sdk' import { useDispatch } from 'react-redux' import { fileToSdk } from '~/adapters' -import { - Name, - type StemUploadWithFile, - isContentFollowGated, - Feature -} from '~/models' +import { Name, type StemUploadWithFile, isContentFollowGated } from '~/models' import { type TrackForUpload, uploadActions, @@ -165,8 +160,7 @@ export const useUpload = ( const dispatch = useDispatch() const { audiusSdk, - analytics: { make, track }, - reportToSentry + analytics: { make, track } } = useQueryContext() const { mutateAsync: publishTracksAsync } = usePublishTracks() @@ -524,19 +518,7 @@ export const useUpload = ( kind: uploadType === UploadType.ALBUM ? 'album' : 'playlist' }) ) - reportToSentry({ - error: err as Error, - name: 'Upload: Collection Publish', - additionalInfo: { - collectionType: uploadType, - trackCount: tracks.length, - tracks: tracks.map((t) => ({ - title: t.metadata.title, - hasStems: !!t.metadata.stems?.length - })) - }, - feature: Feature.Upload - }) + console.error('Upload: Collection Publish', err as Error) dispatch(uploadTracksFailed()) onError?.(err as Error) } @@ -552,7 +534,6 @@ export const useUpload = ( publishTracksAsync, uploadCollectionArtwork, publishCollectionAsync, - reportToSentry, onError, onSuccess ] diff --git a/packages/common/src/api/tan-query/upload/useUploadFiles.ts b/packages/common/src/api/tan-query/upload/useUploadFiles.ts index e623bb9cfb0..f6443155477 100644 --- a/packages/common/src/api/tan-query/upload/useUploadFiles.ts +++ b/packages/common/src/api/tan-query/upload/useUploadFiles.ts @@ -2,7 +2,6 @@ import { useCallback } from 'react' import type { UploadTrackFilesTask } from '@audius/sdk' -import { Feature } from '~/models' import { uploadActions, ProgressStatus } from '~/store' import { useQueryContext } from '../utils' @@ -13,7 +12,7 @@ type UploadTrackFilesTaskWithClientId = UploadTrackFilesTask & { } export const useUploadFiles = () => { - const { dispatch, reportToSentry } = useQueryContext() + const { dispatch } = useQueryContext() const uploadFiles = useCallback( async (tasks: UploadTrackFilesTaskWithClientId[]) => { return await Promise.all( @@ -30,11 +29,7 @@ export const useUploadFiles = () => { progress: { status: ProgressStatus.ERROR } }) ) - reportToSentry({ - error: e as Error, - name: 'Upload: Upload Track File', - feature: Feature.Upload - }) + console.error('Upload: Upload Track File', e as Error) return { clientId: u.clientId, audioUploadResponse: null, @@ -45,7 +40,7 @@ export const useUploadFiles = () => { }) ) }, - [dispatch, reportToSentry] + [dispatch] ) return uploadFiles } diff --git a/packages/common/src/api/tan-query/users/account/useResendRecoveryEmail.ts b/packages/common/src/api/tan-query/users/account/useResendRecoveryEmail.ts index 483a5dca322..0422095cdab 100644 --- a/packages/common/src/api/tan-query/users/account/useResendRecoveryEmail.ts +++ b/packages/common/src/api/tan-query/users/account/useResendRecoveryEmail.ts @@ -11,8 +11,7 @@ import { useQueryContext } from '../../utils' * packages/web/src/common/store/recovery-email/sagas.ts. */ export const useResendRecoveryEmail = () => { - const { authService, identityService, analytics, reportToSentry } = - useQueryContext() + const { authService, identityService, analytics } = useQueryContext() const { getHostUrl } = useAppContext() return useMutation({ @@ -33,10 +32,10 @@ export const useResendRecoveryEmail = () => { ) }, onError: (error) => { - reportToSentry({ - error: error instanceof Error ? error : new Error(String(error)), - name: 'Resend Recovery: Failed to send recovery email' - }) + console.error( + 'Resend Recovery: Failed to send recovery email', + error instanceof Error ? error : new Error(String(error)) + ) } }) } diff --git a/packages/common/src/api/tan-query/users/useFollowUser.ts b/packages/common/src/api/tan-query/users/useFollowUser.ts index 412373c322f..4411ce22c91 100644 --- a/packages/common/src/api/tan-query/users/useFollowUser.ts +++ b/packages/common/src/api/tan-query/users/useFollowUser.ts @@ -6,7 +6,6 @@ import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils' import { useAppContext } from '~/context/appContext' import { Name, FollowSource } from '~/models/Analytics' -import { Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { UserMetadata } from '~/models/User' @@ -26,7 +25,7 @@ type MutationContext = { } export const useFollowUser = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const { data: currentUserId } = useCurrentUserId() const { @@ -115,11 +114,7 @@ export const useFollowUser = () => { return { previousUser } }, - onError: ( - error, - { followeeUserId }, - context: MutationContext | undefined - ) => { + onError: (error, _args, context: MutationContext | undefined) => { const { previousUser } = context ?? {} if (previousUser) { @@ -130,14 +125,7 @@ export const useFollowUser = () => { }) } - reportToSentry({ - error, - additionalInfo: { - followeeUserId - }, - feature: Feature.Social, - name: 'Follow User' - }) + console.error(error) } }) } diff --git a/packages/common/src/api/tan-query/users/useUnfollowUser.ts b/packages/common/src/api/tan-query/users/useUnfollowUser.ts index 474b3fbaecd..ddcb2650176 100644 --- a/packages/common/src/api/tan-query/users/useUnfollowUser.ts +++ b/packages/common/src/api/tan-query/users/useUnfollowUser.ts @@ -5,7 +5,6 @@ import { useDispatch } from 'react-redux' import { useQueryContext } from '~/api/tan-query/utils/QueryContext' import { useAppContext } from '~/context/appContext' import { Name, FollowSource } from '~/models/Analytics' -import { Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { UserMetadata } from '~/models/User' import { removeFolloweeId } from '~/store/gated-content/slice' @@ -25,7 +24,7 @@ type MutationContext = { } export const useUnfollowUser = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const dispatch = useDispatch() const { @@ -104,11 +103,7 @@ export const useUnfollowUser = () => { return { previousUser } }, - onError: ( - error, - { followeeUserId }, - context: MutationContext | undefined - ) => { + onError: (error, _args, context: MutationContext | undefined) => { const { previousUser } = context ?? {} if (previousUser) { @@ -119,14 +114,7 @@ export const useUnfollowUser = () => { }) } - reportToSentry({ - error, - additionalInfo: { - followeeUserId - }, - feature: Feature.Social, - name: 'Unfollow User' - }) + console.error(error) } }) } diff --git a/packages/common/src/api/tan-query/users/useUpdateProfile.ts b/packages/common/src/api/tan-query/users/useUpdateProfile.ts index 1c6c7a7dbcc..61e04fcaeb9 100644 --- a/packages/common/src/api/tan-query/users/useUpdateProfile.ts +++ b/packages/common/src/api/tan-query/users/useUpdateProfile.ts @@ -3,7 +3,6 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { userMetadataToSdk } from '~/adapters/user' import { primeUserData, useQueryContext } from '~/api/tan-query/utils' -import { Feature } from '~/models/ErrorReporting' import { UserMetadata, WriteableUserMetadata } from '~/models/User' import { dataURLtoFile } from '~/utils' import { squashNewLines } from '~/utils/formatUtil' @@ -16,7 +15,7 @@ export type MutationContext = { } export const useUpdateProfile = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() const { data: currentUserId } = useCurrentUserId() @@ -92,14 +91,7 @@ export const useUpdateProfile = () => { }) } - reportToSentry({ - error, - additionalInfo: { - metadata - }, - feature: Feature.Edit, - name: 'Edit Profile' - }) + console.error(error) }, onSettled: (_, __) => { // Always refetch after error or success to ensure cache is in sync with server diff --git a/packages/common/src/api/tan-query/utils/QueryContext.ts b/packages/common/src/api/tan-query/utils/QueryContext.ts index abafa33581b..4a5d81f9891 100644 --- a/packages/common/src/api/tan-query/utils/QueryContext.ts +++ b/packages/common/src/api/tan-query/utils/QueryContext.ts @@ -16,8 +16,7 @@ import { import { AllTrackingEvents, AnalyticsEvent, - IdentifyTraits, - ReportToSentryArgs + IdentifyTraits } from '../../../models' export type QueryContextType = { @@ -27,7 +26,6 @@ export type QueryContextType = { solanaWalletService: SolanaWalletService identityService: IdentityService dispatch: Dispatch - reportToSentry: (args: ReportToSentryArgs) => void env: Env fetch: typeof fetch remoteConfigInstance: RemoteConfigInstance @@ -96,8 +94,6 @@ export function* getQueryContext(): Generator { remoteConfigInstance: yield* getContext< QueryContextType['remoteConfigInstance'] >('remoteConfigInstance'), - reportToSentry: - yield* getContext('reportToSentry'), analytics: yield* getContext('analytics'), nftClient: null, imageUtils: yield* getContext('imageUtils') diff --git a/packages/common/src/api/tan-query/utils/defaultConfig.ts b/packages/common/src/api/tan-query/utils/defaultConfig.ts index 2c34fb97402..f610f48879d 100644 --- a/packages/common/src/api/tan-query/utils/defaultConfig.ts +++ b/packages/common/src/api/tan-query/utils/defaultConfig.ts @@ -1,11 +1,5 @@ import { Query, QueryKey } from '@tanstack/react-query' -import { - ErrorLevel, - Feature, - ReportToSentryArgs -} from '~/models/ErrorReporting' - export const MAX_RETRIES = 3 export const HTTP_STATUSES_TO_NOT_RETRY = [400, 401, 403, 404] @@ -24,26 +18,15 @@ export const defaultRetryConfig = (failureCount: number, error: any) => { return true } -type ReportToSentry = (args: ReportToSentryArgs) => Promise - export const queryErrorHandler = ( err: unknown, - query: Query, - reportToSentry: ReportToSentry + query: Query ) => { const error = err instanceof Error ? err : new Error(String(err)) - reportToSentry({ - error, - level: ErrorLevel.Error, - feature: Feature.TanQuery, - name: `Query Error: ${query.queryKey[0] as string}`, - additionalInfo: { - queryHookMetadata: { - queryKey: query.queryKey, - isActive: query.isActive, - isStale: query.isStale, - isDisabled: query.isDisabled - } - } + console.error(`Query Error: ${query.queryKey[0] as string}`, error, { + queryKey: query.queryKey, + isActive: query.isActive, + isStale: query.isStale, + isDisabled: query.isDisabled }) } diff --git a/packages/common/src/api/tan-query/wallets/useAssociatedWallets.ts b/packages/common/src/api/tan-query/wallets/useAssociatedWallets.ts index 3d7deac1368..26e42c63fa9 100644 --- a/packages/common/src/api/tan-query/wallets/useAssociatedWallets.ts +++ b/packages/common/src/api/tan-query/wallets/useAssociatedWallets.ts @@ -90,7 +90,7 @@ type AddConnectedWalletParams = { export const useAddAssociatedWallet = () => { const queryClient = useQueryClient() - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const { data: currentUserId = null } = useCurrentUserId() // for priming cache @@ -150,10 +150,7 @@ export const useAddAssociatedWallet = () => { getConnectedWalletsQueryKey({ userId: currentUserId }), context?.previousAssociatedWallets ) - reportToSentry({ - error, - name: 'Add Connected Wallet' - }) + console.error(error) } }) } @@ -164,7 +161,7 @@ export type RemoveConnectedWalletParams = { export const useRemoveAssociatedWallet = () => { const queryClient = useQueryClient() - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const { data: currentUserId } = useCurrentUserId() // for priming cache @@ -217,10 +214,7 @@ export const useRemoveAssociatedWallet = () => { type: 'error' }) ) - reportToSentry({ - error, - name: 'Remove Connected Wallet' - }) + console.error(error) } }) } diff --git a/packages/common/src/api/tan-query/wallets/useAudioBalance.ts b/packages/common/src/api/tan-query/wallets/useAudioBalance.ts index 66d895d5ea6..36201abbdcf 100644 --- a/packages/common/src/api/tan-query/wallets/useAudioBalance.ts +++ b/packages/common/src/api/tan-query/wallets/useAudioBalance.ts @@ -16,7 +16,6 @@ import { type QueryContextType } from '~/api/tan-query/utils/QueryContext' import { Chain, ID } from '~/models' -import { Feature } from '~/models/ErrorReporting' import { toErrorWithMessage } from '~/utils/error' import { QUERY_KEYS } from '../queryKeys' @@ -43,7 +42,7 @@ export const getWalletAudioBalanceQueryKey = ({ type FetchAudioBalanceContext = Pick< QueryContextType, - 'audiusSdk' | 'audiusBackend' | 'reportToSentry' + 'audiusSdk' | 'audiusBackend' > const getWalletAudioBalanceQueryFn = @@ -54,7 +53,7 @@ const getWalletAudioBalanceQueryFn = ReturnType >) => { const [_ignored, chain, address, { includeStaked }] = queryKey - const { audiusSdk, audiusBackend, reportToSentry } = context + const { audiusSdk, audiusBackend } = context try { const sdk = await audiusSdk() if (chain === Chain.Eth) { @@ -81,12 +80,7 @@ const getWalletAudioBalanceQueryFn = return AUDIO(wAUDIO(BigInt(wAudioSolBalance.toString()))).value } } catch (error) { - reportToSentry({ - error: toErrorWithMessage(error), - name: 'AudioBalanceFetchError', - feature: Feature.TanQuery, - additionalInfo: { address, chain } - }) + console.error('AudioBalanceFetchError', toErrorWithMessage(error)) throw error } } diff --git a/packages/common/src/api/tan-query/wallets/useExternalWalletBalance.ts b/packages/common/src/api/tan-query/wallets/useExternalWalletBalance.ts index 1eec95ec376..9c8798e17e0 100644 --- a/packages/common/src/api/tan-query/wallets/useExternalWalletBalance.ts +++ b/packages/common/src/api/tan-query/wallets/useExternalWalletBalance.ts @@ -9,7 +9,6 @@ import { useQueryContext, type QueryContextType } from '~/api/tan-query/utils/QueryContext' -import { Feature } from '~/models/ErrorReporting' import { TOKEN_LISTING_MAP } from '~/store' import { toErrorWithMessage } from '~/utils/error' @@ -47,11 +46,11 @@ export const getExternalWalletBalanceQueryKey = ({ type FetchExternalWalletBalanceContext = Pick< QueryContextType, - 'audiusSdk' | 'env' | 'reportToSentry' + 'audiusSdk' | 'env' > const getExternalWalletBalanceQueryFn = - (context: FetchExternalWalletBalanceContext) => + (_context: FetchExternalWalletBalanceContext) => async ({ queryKey }: QueryFunctionContext< @@ -61,7 +60,6 @@ const getExternalWalletBalanceQueryFn = if (!walletAddress || !mint) { throw new Error('Wallet address and mint are required') } - const { reportToSentry } = context try { // Call Jupiter API to get balances const response = await fetch( @@ -93,12 +91,10 @@ const getExternalWalletBalanceQueryFn = // Convert raw balance to FixedDecimal with proper decimals return new FixedDecimal(tokenBalance.uiAmount, tokenBalance.decimals) } catch (error) { - reportToSentry({ - error: toErrorWithMessage(error), - name: 'ExternalWalletBalanceFetchError', - feature: Feature.TanQuery, - additionalInfo: { walletAddress, mint } - }) + console.error( + 'ExternalWalletBalanceFetchError', + toErrorWithMessage(error) + ) throw error } } diff --git a/packages/common/src/api/tan-query/wallets/useSendCoins.ts b/packages/common/src/api/tan-query/wallets/useSendCoins.ts index 0e999a6e23d..07f1c1a0743 100644 --- a/packages/common/src/api/tan-query/wallets/useSendCoins.ts +++ b/packages/common/src/api/tan-query/wallets/useSendCoins.ts @@ -38,8 +38,7 @@ export type SendCoinsResult = { */ export const useSendCoins = ({ mint }: { mint: string }) => { const queryClient = useQueryClient() - const { audiusBackend, audiusSdk, reportToSentry, analytics, env } = - useQueryContext() + const { audiusBackend, audiusSdk, analytics, env } = useQueryContext() const { data: walletAddresses } = useWalletAddresses() const { data: currentUser } = useCurrentAccountUser() @@ -203,16 +202,10 @@ export const useSendCoins = ({ mint }: { mint: string }) => { } } - if (reportToSentry) { - reportToSentry({ - error: error instanceof Error ? error : new Error(error as string), - name: 'Send Coins', - additionalInfo: { - amount: amount.toString(), - mint - } - }) - } + console.error( + 'Send Coins', + error instanceof Error ? error : new Error(error as string) + ) } }) } diff --git a/packages/common/src/hooks/chats/useSetInboxPermissions.ts b/packages/common/src/hooks/chats/useSetInboxPermissions.ts index bf0c34d2ef7..f7ac1fa37ab 100644 --- a/packages/common/src/hooks/chats/useSetInboxPermissions.ts +++ b/packages/common/src/hooks/chats/useSetInboxPermissions.ts @@ -18,7 +18,7 @@ const { fetchPermissions } = chatActions const { getChatPermissionsStatus, getUserChatPermissions } = chatSelectors export const useSetInboxPermissions = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const dispatch = useDispatch() const { data: userId } = useCurrentUserId() const permissions = useSelector((state: CommonState) => @@ -50,10 +50,7 @@ export const useSetInboxPermissions = () => { }) ) } catch (e) { - reportToSentry({ - name: 'Chats', - error: e as Error - }) + console.error('Chats', e as Error) track( make({ eventName: Name.CHANGE_INBOX_SETTINGS_FAILURE, @@ -62,7 +59,7 @@ export const useSetInboxPermissions = () => { ) } }, - [audiusSdk, doFetchPermissions, track, make, reportToSentry] + [audiusSdk, doFetchPermissions, track, make] ) return { diff --git a/packages/common/src/hooks/useChangeEmailFormConfiguration.ts b/packages/common/src/hooks/useChangeEmailFormConfiguration.ts index 26533eb937a..4167a55b851 100644 --- a/packages/common/src/hooks/useChangeEmailFormConfiguration.ts +++ b/packages/common/src/hooks/useChangeEmailFormConfiguration.ts @@ -71,7 +71,6 @@ export const useChangeEmailFormConfiguration = (onComplete: () => void) => { () => toFormikValidationSchema(emailSchema(queryContext, queryClient)), [queryContext, queryClient] ) - const reportToSentry = queryContext.reportToSentry const validationSchema = page === ChangeEmailPage.ConfirmPassword @@ -136,11 +135,11 @@ export const useChangeEmailFormConfiguration = (onComplete: () => void) => { } else { helpers.setFieldError('otp', messages.somethingWrong) helpers.setFieldError('email', messages.somethingWrong) - reportToSentry({ error: e as Error, name: 'ChangeEmail' }) + console.error('ChangeEmail', e as Error) } } }, - [setPage, onComplete, authService, reportToSentry] + [setPage, onComplete, authService] ) const onSubmit = useCallback( diff --git a/packages/common/src/hooks/useShareAction.ts b/packages/common/src/hooks/useShareAction.ts index 2c37cd539e9..aba50855e79 100644 --- a/packages/common/src/hooks/useShareAction.ts +++ b/packages/common/src/hooks/useShareAction.ts @@ -5,9 +5,9 @@ import { Id } from '@audius/sdk' import { useCurrentUserId } from '~/api/tan-query/users/account/useCurrentUserId' import { useQueryContext } from '~/api/tan-query/utils/QueryContext' -/** Sends an EntityManager share action. Fire and forget. Will report to sentry if it fails. */ +/** Sends an EntityManager share action. Fire and forget. Logs to console if it fails. */ export const useShareAction = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const { data: userId } = useCurrentUserId() return useCallback( @@ -34,17 +34,12 @@ export const useShareAction = () => { }) } } catch (error) { - reportToSentry({ - error: error as Error, - name: 'Failed to send EntityManager share action', - additionalInfo: { - userId, - entityId, - entityType - } - }) + console.error( + 'Failed to send EntityManager share action', + error as Error + ) } }, - [audiusSdk, userId, reportToSentry] + [audiusSdk, userId] ) } diff --git a/packages/common/src/models/ErrorReporting.ts b/packages/common/src/models/ErrorReporting.ts deleted file mode 100644 index cc619255850..00000000000 --- a/packages/common/src/models/ErrorReporting.ts +++ /dev/null @@ -1,84 +0,0 @@ -export enum ErrorLevel { - /** - * FATAL - * What to use for: anything that results in app crash / "Something went wrong" - * These are high prio for on-call to look into, and generally should trigger an alert of some kind. - * Applies to scenarios that are completely unrecoverable other than to refresh client - */ - 'Fatal' = 'Fatal', - - /** - * ERROR - * What to use for: Unexpected breakage but recoverable for the user. - * e.g. click button but fails & shows error toast. Generally applies things that can be "retried" by the user - */ - 'Error' = 'Error', - - /** - * WARNING - * What to use for: Something not ideal but within realm of expected behavior - * e.g. api call failure - */ - 'Warning' = 'Warning', - - // Misc levels that we generally don't use with sentry since we typically send these to generic console - 'Debug' = 'Debug', - 'Info' = 'Info', - 'Log' = 'Log' -} -export type AdditionalErrorReportInfo = Record - -/** - * Areas of our app that we want to group sentry logs together in - * Used to create query-able sentry tags - */ -export enum Feature { - SignUp = 'sign-up', - SignIn = 'sign-in', - Upload = 'upload', - Playback = 'playback', - Purchase = 'purchase', - Comments = 'comments', - Chats = 'chats', - Social = 'social', - Notifications = 'notifications', - Rewards = 'rewards', - Edit = 'edit', - Events = 'events', - Remixes = 'remixes', - TanQuery = 'tan-query', - SendTokens = 'send-tokens', - FanClubs = 'fan-clubs' -} - -export type ReportToSentryArgs = { - /** - * The raw JS `Error` to report to sentry. Note: strings are not allowed; - * if you don't have an error object to log just create one via new Error('message') - */ - error: Error - /** - * The severity level that we should report to sentry - * Defaults to ErrorLevel.Error - */ - level?: ErrorLevel - /** - * Any additional info to report (can be any object, but ) - * is generally the right way to report. - */ - additionalInfo?: AdditionalErrorReportInfo - /** - * An optional name to assign to the Error - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name - */ - name?: string - /** - * Adds queryable sentry tags - * https://docs.sentry.io/platforms/javascript/enriching-events/tags/ - */ - tags?: Record - /** - * Which core flow of the app the error should be bucketed in - */ - feature?: Feature -} diff --git a/packages/common/src/models/index.ts b/packages/common/src/models/index.ts index 72f892aa328..40d7610b4b3 100644 --- a/packages/common/src/models/index.ts +++ b/packages/common/src/models/index.ts @@ -9,7 +9,6 @@ export * from './Collection' export * from './Color' export * from './DogEar' export * from './DownloadQuality' -export * from './ErrorReporting' export * from './Favorite' export * from './FeedFilter' export * from './FeedTab' diff --git a/packages/common/src/services/audius-backend/AudiusBackend.ts b/packages/common/src/services/audius-backend/AudiusBackend.ts index 180bcabbeda..3e61f8db9b5 100644 --- a/packages/common/src/services/audius-backend/AudiusBackend.ts +++ b/packages/common/src/services/audius-backend/AudiusBackend.ts @@ -28,7 +28,6 @@ import dayjs from '~/utils/dayjs' import { ID, ComputedUserProperties, WriteableUserMetadata } from '../../models' import { AnalyticsEvent } from '../../models/Analytics' -import { ReportToSentryArgs } from '../../models/ErrorReporting' import * as schemas from '../../schemas' import { FeatureFlags, @@ -124,12 +123,7 @@ type AudiusBackendParams = { nativeMobile: Maybe recaptchaSiteKey: Maybe recordAnalytics: (event: AnalyticsEvent, callback?: () => void) => void - reportError: ({ - level, - additionalInfo, - error, - name - }: ReportToSentryArgs) => void | Promise + reportError: (args: { error: Error }) => void | Promise registryAddress: Maybe entityManagerAddress: Maybe remoteConfigInstance: RemoteConfigInstance diff --git a/packages/common/src/services/env.ts b/packages/common/src/services/env.ts index d7d9f805ba1..eac4c2418e4 100644 --- a/packages/common/src/services/env.ts +++ b/packages/common/src/services/env.ts @@ -61,7 +61,6 @@ export type Env = { REOWN_PROJECT_ID: string SAFARI_WEB_PUSH_ID: string SCHEME: string - SENTRY_DSN: string SOL_BRIDGE_ADDRESS: Nullable SOL_TOKEN_BRIDGE_ADDRESS: Nullable SOLANA_CLUSTER_ENDPOINT: string diff --git a/packages/common/src/services/remote-config/defaults.ts b/packages/common/src/services/remote-config/defaults.ts index 31277de6989..f204018b946 100644 --- a/packages/common/src/services/remote-config/defaults.ts +++ b/packages/common/src/services/remote-config/defaults.ts @@ -90,8 +90,7 @@ export const remoteConfigDoubleDefaults: { [key in DoubleKeys]: number | null } = { [DoubleKeys.SHOW_ARTIST_RECOMMENDATIONS_FALLBACK_PERCENT]: 0.3333, - [DoubleKeys.SHOW_ARTIST_RECOMMENDATIONS_PERCENT]: 1.0, - [DoubleKeys.SENTRY_REPLAY_ERROR_SAMPLE_RATE]: 0.0 + [DoubleKeys.SHOW_ARTIST_RECOMMENDATIONS_PERCENT]: 1.0 } export const remoteConfigBooleanDefaults: { [key in BooleanKeys]: boolean | null diff --git a/packages/common/src/services/remote-config/types.ts b/packages/common/src/services/remote-config/types.ts index deaf39200f3..e3feca2ce87 100644 --- a/packages/common/src/services/remote-config/types.ts +++ b/packages/common/src/services/remote-config/types.ts @@ -244,10 +244,7 @@ export enum DoubleKeys { /** * How often we should show suggested follows after a user follows another user */ - SHOW_ARTIST_RECOMMENDATIONS_PERCENT = 'SHOW_ARTIST_RECOMMENDATIONS_PERCENT', - - /** How many Sentry error recordings we sample. Value ranges from 0.0-1.0 */ - SENTRY_REPLAY_ERROR_SAMPLE_RATE = 'SENTRY_REPLAY_ERROR_SAMPLE_RATE' + SHOW_ARTIST_RECOMMENDATIONS_PERCENT = 'SHOW_ARTIST_RECOMMENDATIONS_PERCENT' } export enum StringKeys { diff --git a/packages/common/src/store/account/sagas.ts b/packages/common/src/store/account/sagas.ts index e4f427ab383..18ee14e2e0a 100644 --- a/packages/common/src/store/account/sagas.ts +++ b/packages/common/src/store/account/sagas.ts @@ -19,7 +19,7 @@ import { getWalletAccountSaga } from '~/api' import { getAccountStatusQueryKey } from '~/api/tan-query/users/account/useAccountStatus' -import { AccountUserMetadata, ErrorLevel, Status, UserMetadata } from '~/models' +import { AccountUserMetadata, Status, UserMetadata } from '~/models' import { getContext } from '~/store/effects' import { chatActions } from '~/store/pages/chat' import { UPLOAD_TRACKS_SUCCEEDED } from '~/store/upload/actions' @@ -84,28 +84,6 @@ function* handleUploadTrack() { yield* put(setHasTracks(true)) } -/** - * Sets the sentry user so that alerts are tied to a user - */ -function* setSentryUser( - user: Pick, - traits: Record -) { - const sentry = yield* getContext('sentry') - if (traits.isVerified) { - sentry.setTag('isVerified', `${traits.isVerified}`) - } - if (traits.managerUserId) { - sentry.setTag('isManagerMode', 'true') - } - const scope = sentry.getCurrentScope() - scope.setUser({ - id: `${user.user_id}`, - username: user.handle, - ...traits - }) -} - function* initializeMetricsForUser({ accountUser, web3WalletAddress @@ -165,7 +143,6 @@ function* initializeMetricsForUser({ } yield* call([analytics, analytics.identify], traits) - yield* call(setSentryUser, accountUser, traits) } } @@ -177,7 +154,6 @@ export function* fetchAccountAsync({ const audiusBackendInstance = yield* getContext('audiusBackendInstance') const remoteConfigInstance = yield* getContext('remoteConfigInstance') const localStorage = yield* getContext('localStorage') - const reportToSentry = yield* getContext('reportToSentry') const sdk = yield* getSDK() const queryClient = yield* getContext('queryClient') @@ -202,10 +178,7 @@ export function* fetchAccountAsync({ wallet = accountWalletAddressOverride ?? web3WalletAddress } catch (e) { if (!(e instanceof HedgehogWalletNotFoundError)) { - yield* call(reportToSentry, { - name: 'FetchAccountAsync', - error: e as Error - }) + console.error('FetchAccountAsync', e) } } if (!wallet || !web3WalletAddress) { @@ -261,10 +234,7 @@ export function* fetchAccountAsync({ try { yield* call(recordIPIfNotRecent, user.handle) } catch (e) { - yield* call(reportToSentry, { - name: 'FetchAccountAsync', - error: e as Error - }) + console.error('FetchAccountAsync', e) } } @@ -315,7 +285,6 @@ export function* fetchAccountAsync({ function* fetchLocalAccountAsync() { const localStorage = yield* getContext('localStorage') - const reportToSentry = yield* getContext('reportToSentry') const sdk = yield* getSDK() const queryClient = yield* getContext('queryClient') @@ -345,10 +314,7 @@ function* fetchLocalAccountAsync() { wallet = accountWalletAddressOverride ?? web3WalletAddress } catch (e) { if (!(e instanceof HedgehogWalletNotFoundError)) { - yield* call(reportToSentry, { - name: 'FetchLocalAccountAsync', - error: e as Error - }) + console.error('FetchLocalAccountAsync', e) } } @@ -428,21 +394,15 @@ function* recordIPIfNotRecent(handle: string): SagaIterator { function* associateTwitterAccount(action: ReturnType) { const { uuid: twitterId, profile } = action.payload const identityService = yield* getContext('identityService') - const reportToSentry = yield* getContext('reportToSentry') const queryClient = yield* getContext('queryClient') const userId = yield* call(queryCurrentUserId) const accountUser = yield* call(queryAccountUser) const handle = accountUser?.handle if (!userId || !handle) { - reportToSentry({ - error: new Error('Missing userId or handle'), - name: 'Failed to associate Twitter Account', - additionalInfo: { - handle, - userId, - twitterId - } - }) + console.error( + 'Failed to associate Twitter Account', + new Error('Missing userId or handle') + ) return } @@ -464,36 +424,22 @@ function* associateTwitterAccount(action: ReturnType) { } } catch (err) { const error = err instanceof Error ? err : new Error(err as string) - reportToSentry({ - error, - name: 'Failed to associate Twitter Account', - additionalInfo: { - handle, - userId, - twitterId - } - }) + console.error(error) } } function* associateInstagramAccount(action: ReturnType) { const { uuid: instagramId, profile } = action.payload const identityService = yield* getContext('identityService') - const reportToSentry = yield* getContext('reportToSentry') const queryClient = yield* getContext('queryClient') const userId = yield* call(queryCurrentUserId) const accountUser = yield* call(queryAccountUser) const handle = accountUser?.handle if (!userId || !handle) { - reportToSentry({ - error: new Error('Missing userId or handle'), - name: 'Failed to associate Instagram Account', - additionalInfo: { - handle, - userId, - instagramId - } - }) + console.error( + 'Failed to associate Instagram Account', + new Error('Missing userId or handle') + ) return } @@ -515,36 +461,22 @@ function* associateInstagramAccount(action: ReturnType) { } } catch (err) { const error = err instanceof Error ? err : new Error(err as string) - reportToSentry({ - error, - name: 'Failed to associate Instagram Account', - additionalInfo: { - handle, - userId, - instagramId - } - }) + console.error(error) } } function* associateTikTokAccount(action: ReturnType) { const { uuid: tikTokId, profile } = action.payload const identityService = yield* getContext('identityService') - const reportToSentry = yield* getContext('reportToSentry') const queryClient = yield* getContext('queryClient') const userId = yield* call(queryCurrentUserId) const accountUser = yield* call(queryAccountUser) const handle = accountUser?.handle if (!userId || !handle) { - reportToSentry({ - error: new Error('Missing userId or handle'), - name: 'Failed to associate TikTok Account', - additionalInfo: { - handle, - userId, - tikTokId - } - }) + console.error( + 'Failed to associate TikTok Account', + new Error('Missing userId or handle') + ) return } @@ -566,15 +498,7 @@ function* associateTikTokAccount(action: ReturnType) { } } catch (err) { const error = err instanceof Error ? err : new Error(err as string) - reportToSentry({ - error, - name: 'Failed to associate TikTok Account', - additionalInfo: { - handle, - userId, - tikTokId - } - }) + console.error(error) } } @@ -596,12 +520,9 @@ function* watchFetchAccountFailed() { fetchAccountFailed.type, function* (action: ReturnType) { const userId = yield* call(queryCurrentUserId) - const reportToSentry = yield* getContext('reportToSentry') if (userId) { - yield* call(reportToSentry, { - level: ErrorLevel.Error, - error: new Error(`Fetch account failed: ${action.payload.reason}`), - additionalInfo: { userId } + console.error(`Fetch account failed: ${action.payload.reason}`, { + userId }) } } diff --git a/packages/common/src/store/buy-usdc/sagas.ts b/packages/common/src/store/buy-usdc/sagas.ts index 5416392dd91..abe58ddeaeb 100644 --- a/packages/common/src/store/buy-usdc/sagas.ts +++ b/packages/common/src/store/buy-usdc/sagas.ts @@ -12,7 +12,6 @@ import { call, put, race, take, takeLeading } from 'typed-redux-saga' import { queryHasAccount, queryAccountUser, queryWalletAddresses } from '~/api' import { Name } from '~/models/Analytics' -import { ErrorLevel } from '~/models/ErrorReporting' import { PurchaseVendor } from '~/models/PurchaseContent' import { Status } from '~/models/Status' import { StringUSDC } from '~/models/Wallet' @@ -217,7 +216,6 @@ function* doBuyUSDC({ portalHostName } }: ReturnType) { - const reportToSentry = yield* getContext('reportToSentry') const { track, make } = yield* getContext('analytics') const solanaWalletService = yield* getContext('solanaWalletService') const config = yield* call(getBuyUSDCRemoteConfig) @@ -336,11 +334,7 @@ function* doBuyUSDC({ e instanceof BuyUSDCError ? e : new BuyUSDCError(BuyUSDCErrorCode.OnrampError, `${e}`) - yield* call(reportToSentry, { - level: ErrorLevel.Error, - error, - additionalInfo: { userBank } - }) + console.error('BuyUSDC onramp failed', error, { userBank }) yield* put(buyUSDCFlowFailed({ error })) yield* call( track, @@ -359,7 +353,6 @@ function* recoverPurchaseIfNecessary() { const hasAccount = yield* call(queryHasAccount) if (!hasAccount) return - const reportToSentry = yield* getContext('reportToSentry') const { track, make } = yield* getContext('analytics') const audiusBackendInstance = yield* getContext('audiusBackendInstance') const solanaWalletService = yield* getContext('solanaWalletService') @@ -465,10 +458,7 @@ function* recoverPurchaseIfNecessary() { ) } catch (e) { yield* put(recoveryStatusChanged({ status: Status.ERROR })) - yield* call(reportToSentry, { - level: ErrorLevel.Error, - error: e as Error - }) + console.error('BuyUSDC recovery failed', e) yield* call( track, make({ diff --git a/packages/common/src/store/pages/chat/sagas.ts b/packages/common/src/store/pages/chat/sagas.ts index 70f008387ee..d44a8f9f571 100644 --- a/packages/common/src/store/pages/chat/sagas.ts +++ b/packages/common/src/store/pages/chat/sagas.ts @@ -26,7 +26,6 @@ import { queryUsers } from '~/api' import { Name } from '~/models/Analytics' -import { Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { Status } from '~/models/Status' import { inboxUnavailableModalActions } from '~/store/ui/modals' @@ -126,12 +125,7 @@ function* doFetchUnreadMessagesCount() { ) } catch (e) { yield* put(fetchUnreadMessagesCountFailed()) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -195,12 +189,7 @@ export function* doFetchLatestChats() { ) } catch (e) { yield* put(fetchMoreChatsFailed()) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -223,12 +212,7 @@ function* doFetchMoreChats() { yield* put(fetchMoreChatsSucceeded(response)) } catch (e) { yield* put(fetchMoreChatsFailed()) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -288,15 +272,7 @@ function* doFetchLatestMessages( ) } catch (e) { yield* put(fetchMoreMessagesFailed({ chatId })) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - additionalInfo: { - chatId - }, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -350,15 +326,7 @@ function* doFetchMoreMessages(action: ReturnType) { ) } catch (e) { yield* put(fetchMoreMessagesFailed({ chatId })) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - additionalInfo: { - chatId - }, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -398,18 +366,7 @@ function* doSetMessageReaction(action: ReturnType) { ) } catch (e) { yield* put(setMessageReactionFailed(action.payload)) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - additionalInfo: { - chatId, - messageId, - reaction, - userId - }, - feature: Feature.Chats - }) + console.error('Chats', e as Error) yield* call( track, make({ @@ -480,16 +437,8 @@ function* doCreateChat(action: ReturnType) { }) ) } - const reportToSentry = yield* getContext('reportToSentry') if (!isForbiddenError) { - reportToSentry({ - name: 'Chats', - error: e as Error, - additionalInfo: { - userIds - }, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } yield* call(track, make({ eventName: Name.CREATE_CHAT_FAILURE })) } @@ -557,17 +506,7 @@ function* doCreateChatBlast(action: ReturnType) { content: 'Something went wrong. Failed to create chat blast.' }) ) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - additionalInfo: { - audience, - audienceContentId, - audienceContentType - }, - feature: Feature.Chats - }) + console.error('Chats', e as Error) yield* call( track, @@ -596,15 +535,7 @@ function* doMarkChatAsRead(action: ReturnType) { yield* put(markChatAsReadSucceeded({ chatId })) } catch (e) { yield* put(markChatAsReadFailed({ chatId })) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - additionalInfo: { - chatId - }, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -626,12 +557,7 @@ function* doMarkAllChatsAsRead() { content: 'Failed to mark messages as read.' }) ) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -717,16 +643,7 @@ function* doSendMessage(action: ReturnType) { } } } - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - additionalInfo: { - chatId, - messageId: messageIdToUse - }, - feature: Feature.Chats - }) + console.error('Chats', e as Error) yield* call(track, make({ eventName: Name.SEND_MESSAGE_FAILURE })) } } @@ -762,12 +679,7 @@ function* doFetchBlockees() { }) ) } catch (e) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -784,12 +696,7 @@ function* doFetchBlockers() { }) ) } catch (e) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -808,12 +715,7 @@ function* doBlockUser(action: ReturnType) { make({ eventName: Name.BLOCK_USER_SUCCESS, blockedUserId: userId }) ) } catch (e) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - feature: Feature.Chats - }) + console.error('Chats', e as Error) yield* call( track, make({ eventName: Name.BLOCK_USER_FAILURE, blockedUserId: userId }) @@ -830,12 +732,7 @@ function* doUnblockUser(action: ReturnType) { }) yield* put(fetchBlockees()) } catch (e) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -862,12 +759,7 @@ function* doFetchPermissions(action: ReturnType) { }) ) } catch (e) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -891,17 +783,7 @@ function* doFetchLinkUnfurlMetadata( fetchLinkUnfurlSucceeded({ chatId, messageId, unfurlMetadata: data[0] }) ) } catch (e) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - additionalInfo: { - chatId, - messageId, - href - }, - feature: Feature.Chats - }) + console.error('Chats', e as Error) } } @@ -922,32 +804,15 @@ function* doDeleteChat(action: ReturnType) { yield* put(deleteChatSucceeded({ chatId })) yield* call(track, make({ eventName: Name.DELETE_CHAT_SUCCESS })) } catch (e) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - name: 'Chats', - error: e as Error, - additionalInfo: { - chatId - }, - feature: Feature.Chats - }) + console.error('Chats', e as Error) yield* call(track, make({ eventName: Name.DELETE_CHAT_FAILURE })) } } function* doLogError({ payload: { error } }: ReturnType) { const { track, make } = yield* getContext('analytics') - const reportToSentry = yield* getContext('reportToSentry') - const { code, url } = error - reportToSentry({ - name: 'Chats', - error, - additionalInfo: { - code, - url - }, - feature: Feature.Chats - }) + const { code } = error + console.error(error) yield* call(track, make({ eventName: Name.CHAT_WEBSOCKET_ERROR, code })) } diff --git a/packages/common/src/store/playback/slice.ts b/packages/common/src/store/playback/slice.ts index 8ddd547a38f..529d21fbfcd 100644 --- a/packages/common/src/store/playback/slice.ts +++ b/packages/common/src/store/playback/slice.ts @@ -1,6 +1,6 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit' -import { Feature, ID } from '../../models' +import { ID } from '../../models' import { Maybe, Nullable } from '../../utils' import { @@ -156,7 +156,6 @@ type ErrorPayload = { error: string trackId: ID info: string - feature?: Feature } type SetRetriesPayload = { retries: number } diff --git a/packages/common/src/store/purchase-content/sagas.ts b/packages/common/src/store/purchase-content/sagas.ts index a3a01de1e9c..54cb685a6b1 100644 --- a/packages/common/src/store/purchase-content/sagas.ts +++ b/packages/common/src/store/purchase-content/sagas.ts @@ -29,7 +29,6 @@ import { import { isPurchaseableAlbum, PurchaseableContentMetadata } from '~/hooks' import { Collection } from '~/models' import { FavoriteSource, Name } from '~/models/Analytics' -import { ErrorLevel, Feature } from '~/models/ErrorReporting' import { ID } from '~/models/Identifiers' import { PurchaseAccess, @@ -632,7 +631,6 @@ function* doStartPurchaseContentFlow({ } }: ReturnType) { const usdcConfig = yield* call(getBuyUSDCRemoteConfig) - const reportToSentry = yield* getContext('reportToSentry') const { track, make } = yield* getContext('analytics') const audiusSdk = yield* getContext('audiusSdk') const sdk = yield* call(audiusSdk) @@ -886,12 +884,7 @@ function* doStartPurchaseContentFlow({ return } - yield* call(reportToSentry, { - level: ErrorLevel.Error, - error, - additionalInfo: { contentId, contentType }, - feature: Feature.Purchase - }) + console.error('Purchase failed', error, { contentId, contentType }) yield* put(purchaseContentFlowFailed({ error })) yield* put(updateGatedContentStatus({ contentId, status: 'LOCKED' })) yield* call( diff --git a/packages/common/src/store/storeContext.ts b/packages/common/src/store/storeContext.ts index 36dff0e096c..92a01c3625d 100644 --- a/packages/common/src/store/storeContext.ts +++ b/packages/common/src/store/storeContext.ts @@ -13,7 +13,6 @@ import { AnalyticsEvent, IdentifyTraits, LineupState, - ReportToSentryArgs, Track } from '../models' import { AudioPlayer } from '../services/audio-player' @@ -68,11 +67,6 @@ export type CommonStoreContext = { ) => (state: CommonState) => LineupState audioPlayer: AudioPlayer nftClient: null - sentry: { - setTag: (key: string, value: string) => void - getCurrentScope: () => { setUser: (user: any) => void } - } - reportToSentry: (args: ReportToSentryArgs) => void trackDownload: TrackDownload instagramAppId?: string instagramRedirectUrl?: string diff --git a/packages/common/src/store/ui/stripe-modal/sagaHelpers.ts b/packages/common/src/store/ui/stripe-modal/sagaHelpers.ts index 1b1070187e1..fd911bc4aba 100644 --- a/packages/common/src/store/ui/stripe-modal/sagaHelpers.ts +++ b/packages/common/src/store/ui/stripe-modal/sagaHelpers.ts @@ -1,7 +1,6 @@ import { call } from 'typed-redux-saga' import { Name, StripeEventFields } from '~/models/Analytics' -import { ErrorLevel } from '~/models/ErrorReporting' import { getContext } from '~/store/effects' import { StripeSessionData } from './types' @@ -33,7 +32,6 @@ export function* reportStripeFlowAnalytics( session: StripeSessionData, previousSession?: StripeSessionData ) { - const reportToSentry = yield* getContext('reportToSentry') const { track, make } = yield* getContext('analytics') if (!previousSession || session.status !== previousSession.status) { @@ -59,12 +57,8 @@ export function* reportStripeFlowAnalytics( ) break case 'rejected': - yield* call(reportToSentry, { - level: ErrorLevel.Error, - error: new Error('Stripe onramp session status: rejected'), - additionalInfo: { - session: cleanedSession - } + console.error('Stripe onramp session status: rejected', { + session: cleanedSession }) yield* call( track, @@ -93,12 +87,8 @@ export function* reportStripeFlowAnalytics( ) break case 'error': - yield* call(reportToSentry, { - level: ErrorLevel.Error, - error: new Error('Stripe onramp session status: error'), - additionalInfo: { - session: cleanedSession - } + console.error('Stripe onramp session status: error', { + session: cleanedSession }) yield* call( track, diff --git a/packages/common/src/store/ui/stripe-modal/sagas.ts b/packages/common/src/store/ui/stripe-modal/sagas.ts index 4438e556a2e..6da689cbbcd 100644 --- a/packages/common/src/store/ui/stripe-modal/sagas.ts +++ b/packages/common/src/store/ui/stripe-modal/sagas.ts @@ -10,7 +10,6 @@ import { } from 'typed-redux-saga' import { Name } from '~/models/Analytics' -import { ErrorLevel } from '~/models/ErrorReporting' import { IdentityRequestError } from '~/services/auth/identity' import { getContext } from '~/store/effects' @@ -41,7 +40,6 @@ function* handleInitializeStripeModal({ payload: { amount, destinationCurrency, destinationWallet } }: ReturnType) { const identityService = yield* getContext('identityService') - const reportToSentry = yield* getContext('reportToSentry') const { track, make } = yield* getContext('analytics') const { onrampFailed } = yield* select(getStripeModalState) try { @@ -79,16 +77,12 @@ function* handleInitializeStripeModal({ }) } yield* put(setVisibility({ modal: 'StripeOnRamp', visible: 'closing' })) - yield* call(reportToSentry, { - level: ErrorLevel.Error, - error, - additionalInfo: { - code, - stripeErrorMessage, - type, - amount, - destinationCurrency - } + console.error('Stripe session creation error', error, { + code, + stripeErrorMessage, + type, + amount, + destinationCurrency }) yield* call( track, diff --git a/packages/common/src/store/ui/withdraw-usdc/sagas.ts b/packages/common/src/store/ui/withdraw-usdc/sagas.ts index 4c36e054760..3d00689468c 100644 --- a/packages/common/src/store/ui/withdraw-usdc/sagas.ts +++ b/packages/common/src/store/ui/withdraw-usdc/sagas.ts @@ -166,22 +166,19 @@ function* doWithdrawUSDCCoinflow({ }) yield* put(cleanupWithdrawUSDC()) yield* put(closeWithdrawUSDCModal()) - // Buy USDC recovery already logs to sentry and makes an analytics event - // so add some logs to help discern which flow the recovery was triggered - // from and help aid in debugging should this ever hit. + // Buy USDC recovery already logs and makes an analytics event, so add + // some logs to help discern which flow the recovery was triggered from + // and help aid in debugging should this ever hit. if (action.payload.status === Status.ERROR) { - // Breadcrumb hint: console.warn( 'Failed to transfer funds back from root wallet:', rootSolanaAccount.publicKey.toBase58() ) - // Console error for sentry issue console.error('Failed to recover funds from Coinflow Withdraw') } } } catch (e: unknown) { console.error('Withdraw USDC failed', e) - const reportToSentry = yield* getContext('reportToSentry') yield* put(withdrawUSDCFailed({ error: e as Error })) const responseErrorFields = yield* call(getResponseErrorAnalyticsFields, e) @@ -195,9 +192,7 @@ function* doWithdrawUSDCCoinflow({ }) ) - reportToSentry({ - error: e as Error - }) + console.error(e as Error) } } @@ -274,7 +269,6 @@ function* doWithdrawUSDCManualTransfer({ }) } catch (e: unknown) { console.error('Withdraw USDC failed', e) - const reportToSentry = yield* getContext('reportToSentry') yield* put(withdrawUSDCFailed({ error: e as Error })) const responseErrorFields = yield* call(getResponseErrorAnalyticsFields, e) @@ -288,9 +282,7 @@ function* doWithdrawUSDCManualTransfer({ }) ) - reportToSentry({ - error: e as Error - }) + console.error(e as Error) } } diff --git a/packages/common/src/utils/sagaHelpers.ts b/packages/common/src/utils/sagaHelpers.ts index eb84865befa..1b48b68d5c9 100644 --- a/packages/common/src/utils/sagaHelpers.ts +++ b/packages/common/src/utils/sagaHelpers.ts @@ -18,7 +18,6 @@ import { Action } from 'typesafe-actions' // this import needs to be very specific for SSR bundlesize import { getAccountStatusQueryKey } from '~/api/tan-query/users/account/useAccountStatus' -import { ErrorLevel, ReportToSentryArgs } from '~/models' import { waitForReachability } from '~/store/reachability/sagas' import { toast } from '~/store/ui/toast/slice' @@ -187,18 +186,7 @@ export function* sagaWithErrorHandler(saga: () => Generator) { break } catch (e) { yield* put(toast({ content: messages.somethingWrong })) - console.warn(`Saga ${saga.name} failed, restarting...`, e) - - // Force typing of reportToSentry. We're not able to pull it in - // from getContext in ~common as that would require the store. - const reportToSentry: (args: ReportToSentryArgs) => void = - yield* getContext('reportToSentry') as any - - yield* call(reportToSentry, { - name: 'Uncaught Saga Error', - level: ErrorLevel.Error, - error: e as Error - }) + console.error(`Uncaught Saga Error in ${saga.name}`, e) } } } diff --git a/packages/embed/src/util/logError.js b/packages/embed/src/util/logError.js index 816bf7a02e8..ef43b8bcb2f 100644 --- a/packages/embed/src/util/logError.js +++ b/packages/embed/src/util/logError.js @@ -7,5 +7,4 @@ export const logError = (...args) => { ) { console.error(args) } - // TODO: Add Sentry logging } diff --git a/packages/identity-service/default-config.json b/packages/identity-service/default-config.json index 8c674097101..c08a7aa3583 100644 --- a/packages/identity-service/default-config.json +++ b/packages/identity-service/default-config.json @@ -63,7 +63,6 @@ "recaptchaServiceKey": "", "hCaptchaSecret": "", "solanaFeePayerWallets": "[]", - "sentryDSN": "", "solanaEndpoint": "https://api.mainnet-beta.solana.com", "solanaEndpointListensProgram": "https://api.mainnet-beta.solana.com", "stripeSecretKey": "" diff --git a/packages/identity-service/package.json b/packages/identity-service/package.json index cc581485aef..c4c15bef374 100644 --- a/packages/identity-service/package.json +++ b/packages/identity-service/package.json @@ -42,7 +42,6 @@ "@optimizely/optimizely-sdk": "4.6.0", "@sendgrid/client": "7.7.0", "@sendgrid/mail": "7.7.0", - "@sentry/node": "6.2.5", "@solana/buffer-layout": "4.0.1", "@solana/buffer-layout-utils": "0.2.0", "@solana/spl-token": "0.3.8", diff --git a/packages/identity-service/src/app.js b/packages/identity-service/src/app.js index fe5c35bfd56..31727758958 100644 --- a/packages/identity-service/src/app.js +++ b/packages/identity-service/src/app.js @@ -6,7 +6,6 @@ const sgClient = require('@sendgrid/client') const { redisClient, Lock } = require('./redis') const { createFpClient } = require('./fpClient') const optimizelySDK = require('@optimizely/optimizely-sdk') -const Sentry = require('@sentry/node') const cluster = require('cluster') const config = require('./config.js') const txRelay = require('./relay/txRelay') @@ -37,7 +36,6 @@ class App { this.express = express() this.redisClient = redisClient this.fpClient = createFpClient(config.get('fpServerApiKey')) - this.configureSentry() this.configureSendGrid() this.optimizelyPromise = null @@ -160,15 +158,6 @@ class App { ) } - configureSentry() { - const dsn = config.get('sentryDSN') - if (dsn) { - Sentry.init({ - dsn - }) - } - } - configureOptimizely() { const sdkKey = config.get('optimizelySdkKey') const optimizelyClientInstance = optimizelySDK.createInstance({ @@ -400,7 +389,6 @@ class App { function errorHandler(err, req, res, next) { req.logger.error('Internal server error') req.logger.error(err.stack) - Sentry.captureException(err) sendResponse(req, res, errorResponseServerError('Internal server error')) } this.express.use(errorHandler) diff --git a/packages/identity-service/src/config.js b/packages/identity-service/src/config.js index 542aad789f6..50bc37da610 100644 --- a/packages/identity-service/src/config.js +++ b/packages/identity-service/src/config.js @@ -695,12 +695,6 @@ const config = convict({ default: '', env: 'aaoAddress' }, - sentryDSN: { - doc: 'Sentry DSN key', - format: String, - env: 'sentryDSN', - default: '' - }, ethGasMultiplier: { doc: 'Constant value to multiply the configured FAST gas price by - in order to optimize tx success', format: Number, diff --git a/packages/mobile/android/sentry.properties b/packages/mobile/android/sentry.properties deleted file mode 100644 index e5b10f50347..00000000000 --- a/packages/mobile/android/sentry.properties +++ /dev/null @@ -1,4 +0,0 @@ -defaults.url=https://sentry.io/ -defaults.org=audius -defaults.project=audius-client -auth.token=ffe6cd7871b44b1ab42ed98e644fdc9240f1eac620b8406e8795232679e5fceb diff --git a/packages/mobile/ios/AudiusReactNative.xcodeproj/project.pbxproj b/packages/mobile/ios/AudiusReactNative.xcodeproj/project.pbxproj index 8af9e63935f..363384b1db2 100644 --- a/packages/mobile/ios/AudiusReactNative.xcodeproj/project.pbxproj +++ b/packages/mobile/ios/AudiusReactNative.xcodeproj/project.pbxproj @@ -253,7 +253,6 @@ A1B2C3D4E5F6A7B8C9D0E1F2 /* Bundle React Native code and images */, 13B07F8E1A680F5B00A75B9A /* Resources */, 838AABE123CE404D004B2DA3 /* ShellScript */, - 18A5B1D0CA1543ABB2DC5C65 /* Upload Debug Symbols to Sentry */, CBD3B687421F14165031EAF0 /* [CP] Embed Pods Frameworks */, B73C21C532E1201FEFBAECDA /* [CP] Copy Pods Resources */, 23A43AB82E37E73000CDCDF2 /* Embed Foundation Extensions */, @@ -355,20 +354,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 18A5B1D0CA1543ABB2DC5C65 /* Upload Debug Symbols to Sentry */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Upload Debug Symbols to Sentry"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "${SRCROOT}/scripts/uploadSentryDebugSymbols.sh\n"; - }; 4F8185A02FC4BDA0C345B32B /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/packages/mobile/ios/Podfile b/packages/mobile/ios/Podfile index cff6c13dbf0..3d5fc4dfe6b 100644 --- a/packages/mobile/ios/Podfile +++ b/packages/mobile/ios/Podfile @@ -84,9 +84,7 @@ target 'AudiusReactNative' do if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle" target.build_configurations.each do |config| config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' - if target.name != "Sentry" - config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO' - end + config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO' end end end diff --git a/packages/mobile/ios/scripts/uploadSentryDebugSymbols.sh b/packages/mobile/ios/scripts/uploadSentryDebugSymbols.sh deleted file mode 100755 index 09c9246eff8..00000000000 --- a/packages/mobile/ios/scripts/uploadSentryDebugSymbols.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# Sentry has been removed from mobile -echo "Sentry debug symbol upload disabled" \ No newline at end of file diff --git a/packages/mobile/ios/sentry.properties b/packages/mobile/ios/sentry.properties deleted file mode 100644 index e5b10f50347..00000000000 --- a/packages/mobile/ios/sentry.properties +++ /dev/null @@ -1,4 +0,0 @@ -defaults.url=https://sentry.io/ -defaults.org=audius -defaults.project=audius-client -auth.token=ffe6cd7871b44b1ab42ed98e644fdc9240f1eac620b8406e8795232679e5fceb diff --git a/packages/mobile/src/app/App.tsx b/packages/mobile/src/app/App.tsx index 1dfadc9ee5c..f0994701e5c 100644 --- a/packages/mobile/src/app/App.tsx +++ b/packages/mobile/src/app/App.tsx @@ -42,9 +42,6 @@ import { Drawers } from './Drawers' import ErrorBoundary from './ErrorBoundary' import { ThemeProvider } from './ThemeProvider' import './registerNiceModals' -import { initSentry, navigationIntegration } from './sentry' - -initSentry() // Wire the platform-agnostic bridge so common (sagas/services) can drive // nice-modal-react without depending on the package directly. @@ -130,9 +127,7 @@ const App = () => { - + {/* NiceModal-managed modals (e.g. diff --git a/packages/mobile/src/app/AudiusQueryProvider.tsx b/packages/mobile/src/app/AudiusQueryProvider.tsx index 1e96fc7ad77..f5147338ed4 100644 --- a/packages/mobile/src/app/AudiusQueryProvider.tsx +++ b/packages/mobile/src/app/AudiusQueryProvider.tsx @@ -14,7 +14,6 @@ import { authService, solanaWalletService } from 'app/services/sdk/auth' import { identityService } from 'app/services/sdk/identity' import { store } from 'app/store' import { generatePlaylistArtwork } from 'app/utils/generatePlaylistArtwork' -import { reportToSentry } from 'app/utils/reportToSentry' type AudiusQueryProviderProps = { children: ReactNode @@ -27,7 +26,6 @@ export const queryContext = { identityService, solanaWalletService, dispatch: store.dispatch, - reportToSentry, env, fetch, remoteConfigInstance, diff --git a/packages/mobile/src/app/ErrorBoundary.tsx b/packages/mobile/src/app/ErrorBoundary.tsx index 8637abdca16..68064a9a06b 100644 --- a/packages/mobile/src/app/ErrorBoundary.tsx +++ b/packages/mobile/src/app/ErrorBoundary.tsx @@ -1,13 +1,11 @@ import type { ReactNode } from 'react' import { PureComponent, useEffect } from 'react' -import { ErrorLevel } from '@audius/common/models' import type { Nullable } from '@audius/common/utils' import { useToast } from 'app/hooks/useToast' import { make, track } from 'app/services/analytics' import { EventNames } from 'app/types/analytics' -import { reportToSentry } from 'app/utils/reportToSentry' type ErrorToastProps = { error: Nullable @@ -39,11 +37,7 @@ class ErrorBoundary extends PureComponent { componentDidCatch(error: Error | null, errorInfo: any) { // On catch set the error state so it triggers a toast this.setState({ error: error?.message }) - reportToSentry({ - level: ErrorLevel.Fatal, - error: error ?? new Error('Unknown error caught by'), - additionalInfo: errorInfo - }) + console.error(error ?? new Error('Unknown error caught by'), errorInfo) track( make({ eventName: EventNames.APP_ERROR, diff --git a/packages/mobile/src/app/sentry.ts b/packages/mobile/src/app/sentry.ts deleted file mode 100644 index c9665de5cf0..00000000000 --- a/packages/mobile/src/app/sentry.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Sentry removed from mobile - using only console logging and other error tracking - -export const navigationIntegration = null - -export const initSentry = () => { - // No-op: Sentry disabled for mobile - // console.log('Sentry disabled for mobile app') -} diff --git a/packages/mobile/src/components/audio/AudioPlayer.tsx b/packages/mobile/src/components/audio/AudioPlayer.tsx index 1572b5f8287..83f4bbf644b 100644 --- a/packages/mobile/src/components/audio/AudioPlayer.tsx +++ b/packages/mobile/src/components/audio/AudioPlayer.tsx @@ -2,7 +2,7 @@ import { useRef, useEffect, useCallback, useState, useMemo } from 'react' import { useCurrentUserId, useTracks, useUsers } from '@audius/common/api' import { useCurrentTrack } from '@audius/common/hooks' -import { ErrorLevel, Feature, Name, SquareSizes } from '@audius/common/models' +import { Name, SquareSizes } from '@audius/common/models' import type { ID, Track } from '@audius/common/models' import { playbackActions, @@ -57,7 +57,6 @@ import { addOfflineEntries, OfflineDownloadStatus } from 'app/store/offline-downloads/slice' -import { reportToSentry } from 'app/utils/reportToSentry' import { useChromecast } from './GoogleCast' import { useSavePodcastProgress } from './useSavePodcastProgress' @@ -296,17 +295,7 @@ const useQueueSync = (isAudioSetup: boolean) => { : track.duration } } catch (e) { - reportToSentry({ - level: ErrorLevel.Error, - name: 'AudioPlayer: makeTrackData failed', - additionalInfo: { - track, - playerBehavior, - trackOwner: queueTrackOwnersMap[track?.owner_id ?? ''] - }, - feature: Feature.Playback, - error: e - }) + console.error('AudioPlayer: makeTrackData failed', e) return unlistedTrackFallbackTrackData } }, diff --git a/packages/mobile/src/components/download-track-archive-drawer/DownloadTrackArchiveDrawer.tsx b/packages/mobile/src/components/download-track-archive-drawer/DownloadTrackArchiveDrawer.tsx index 55993a7852d..70c8eba9332 100644 --- a/packages/mobile/src/components/download-track-archive-drawer/DownloadTrackArchiveDrawer.tsx +++ b/packages/mobile/src/components/download-track-archive-drawer/DownloadTrackArchiveDrawer.tsx @@ -8,7 +8,7 @@ import { } from '@audius/common/api' import { useAppContext } from '@audius/common/context' import type { ID } from '@audius/common/models' -import { Feature, Name } from '@audius/common/models' +import { Name } from '@audius/common/models' import type { DownloadFile } from '@audius/common/services' import { useDownloadTrackArchiveModal } from '@audius/common/store' @@ -23,7 +23,6 @@ import { } from '@audius/harmony-native' import Drawer from 'app/components/drawer' import { env } from 'app/services/env' -import { reportToSentry } from 'app/utils/reportToSentry' import { DrawerHeader } from '../core/DrawerHeader' import LoadingSpinner from '../loading-spinner' @@ -58,14 +57,7 @@ const useDownloadFile = () => { setSuccess(true) } catch (e) { setError(e as Error) - reportToSentry({ - additionalInfo: { - file - }, - name: 'Failed to download track archive', - error: e as Error, - feature: Feature.Remixes - }) + console.error('Failed to download track archive', e as Error) } finally { setFetching(false) setAbortController(null) diff --git a/packages/mobile/src/components/navigation-container/NavigationContainer.tsx b/packages/mobile/src/components/navigation-container/NavigationContainer.tsx index 6eda5173a8d..ba927cad4e4 100644 --- a/packages/mobile/src/components/navigation-container/NavigationContainer.tsx +++ b/packages/mobile/src/components/navigation-container/NavigationContainer.tsx @@ -19,7 +19,6 @@ import { navigationThemes } from './navigationThemes' type NavigationContainerProps = { children: ReactNode - navigationIntegration: any // Sentry removed - kept for compatibility } export const navigationRef = createNavigationContainerRef() @@ -29,7 +28,7 @@ export const navigationRef = createNavigationContainerRef() * and configures linking */ const NavigationContainer = (props: NavigationContainerProps) => { - const { children, navigationIntegration } = props + const { children } = props const theme = useThemeVariant() const { data: accountHandle } = useCurrentAccountUser({ select: (user) => user?.handle @@ -187,10 +186,6 @@ const NavigationContainer = (props: NavigationContainerProps) => { const onReady = () => { routeNameRef.current = getPrimaryRoute(navigationRef.getRootState()) - // Sentry removed - navigationIntegration is null - if (navigationIntegration?.registerNavigationContainer) { - navigationIntegration.registerNavigationContainer(navigationRef) - } } return ( diff --git a/packages/mobile/src/components/send-tokens-drawer/SendTokensDrawer.tsx b/packages/mobile/src/components/send-tokens-drawer/SendTokensDrawer.tsx index 8c27ab95f7c..c6a26ce3a36 100644 --- a/packages/mobile/src/components/send-tokens-drawer/SendTokensDrawer.tsx +++ b/packages/mobile/src/components/send-tokens-drawer/SendTokensDrawer.tsx @@ -3,12 +3,10 @@ import { useState, useEffect } from 'react' import { useSendCoins } from '@audius/common/api' import { walletMessages } from '@audius/common/messages' import type { SolanaWalletAddress, User } from '@audius/common/models' -import { ErrorLevel, Feature } from '@audius/common/models' import { useSendTokensModal } from '@audius/common/store' import { Divider, Flex } from '@audius/harmony-native' import Drawer from 'app/components/drawer/Drawer' -import { reportToSentry } from 'app/utils/reportToSentry' import { DrawerHeader } from '../drawer/DrawerHeader' @@ -130,17 +128,7 @@ export const SendTokensDrawer = () => { } setError(errorMessage) - reportToSentry({ - level: ErrorLevel.Error, - error: error as Error, - additionalInfo: { - amount: state.amount.toString(), - destinationAddress: state.destinationAddress, - mint: state.selectedMint, - errorString - }, - feature: Feature.SendTokens - }) + console.error(error as Error) setState((prev) => ({ ...prev, step: 'failure' })) } } diff --git a/packages/mobile/src/components/share-drawer/useShareToStory.tsx b/packages/mobile/src/components/share-drawer/useShareToStory.tsx index c9179999e81..b068d652578 100644 --- a/packages/mobile/src/components/share-drawer/useShareToStory.tsx +++ b/packages/mobile/src/components/share-drawer/useShareToStory.tsx @@ -4,7 +4,7 @@ import EventEmitter from 'events' import path from 'path' import { useCurrentUserId } from '@audius/common/api' -import { ErrorLevel, SquareSizes } from '@audius/common/models' +import { SquareSizes } from '@audius/common/models' import type { Color } from '@audius/common/models' import { modalsActions } from '@audius/common/store' import type { ShareContent } from '@audius/common/store' @@ -51,7 +51,6 @@ import { pickTwoMostDominantAndVibrant } from 'app/utils/dominantColors' import { isImageUriSource } from 'app/utils/image' -import { reportToSentry } from 'app/utils/reportToSentry' import { getTrackRoute } from 'app/utils/routes' import { DrawerHeader } from '../core/DrawerHeader' @@ -209,11 +208,7 @@ export const useShareToStory = ({ const handleError = useCallback( (platform: ShareToStoryPlatform, error: Error, name?: string) => { - reportToSentry({ - level: ErrorLevel.Error, - error, - name - }) + console.error(error) toast({ content: messages.shareToStoryError, type: 'error' }) track( make({ diff --git a/packages/mobile/src/screens/coin-details-screen/EditCoinDetailsScreen.tsx b/packages/mobile/src/screens/coin-details-screen/EditCoinDetailsScreen.tsx index 6875298f9db..77ef64dd304 100644 --- a/packages/mobile/src/screens/coin-details-screen/EditCoinDetailsScreen.tsx +++ b/packages/mobile/src/screens/coin-details-screen/EditCoinDetailsScreen.tsx @@ -20,7 +20,6 @@ import { useFormikContext, Formik } from 'formik' import { Image as RNImage, View, StyleSheet } from 'react-native' import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view' import LinearGradient from 'react-native-linear-gradient' -import { reportToSentry } from 'store/errors/reportToSentry' import { IconInstagram, @@ -332,20 +331,7 @@ export const EditCoinDetailsScreen = () => { }) navigation.goBack() } catch (e) { - await reportToSentry({ - name: 'EditCoinDetails', - error: - e instanceof Error - ? e - : new Error( - e instanceof Object && 'message' in e - ? (e.message as string) - : 'Unknown Error' - ), - additionalInfo: { - raw: e - } - }) + await console.error('EditCoinDetails', e instanceof Error) throw e // Re-throw to let Formik handle the error } } diff --git a/packages/mobile/src/screens/notifications-screen/NotificationErrorBoundary.tsx b/packages/mobile/src/screens/notifications-screen/NotificationErrorBoundary.tsx index a083fda0983..f10bba1a8c6 100644 --- a/packages/mobile/src/screens/notifications-screen/NotificationErrorBoundary.tsx +++ b/packages/mobile/src/screens/notifications-screen/NotificationErrorBoundary.tsx @@ -1,8 +1,6 @@ import type { ReactNode } from 'react' import { PureComponent } from 'react' -import { Feature } from '@audius/common/models' - type NotificationErrorBoundaryProps = { children: ReactNode } @@ -14,12 +12,7 @@ export class NotificationErrorBoundary extends PureComponent console.error(error), registryAddress: env.REGISTRY_ADDRESS, entityManagerAddress: env.ENTITY_MANAGER_ADDRESS, remoteConfigInstance, diff --git a/packages/mobile/src/services/env/env.dev.ts b/packages/mobile/src/services/env/env.dev.ts index e86529e87a5..e9075beb3fa 100644 --- a/packages/mobile/src/services/env/env.dev.ts +++ b/packages/mobile/src/services/env/env.dev.ts @@ -64,7 +64,6 @@ export const env: Env = { REWARDS_MANAGER_TOKEN_PDA: 'FRk4j95RG2kSk3BHXBPVgKszFc2rLQ8K6RS83k3dmzvQ', SAFARI_WEB_PUSH_ID: 'web.co.audius', SCHEME: 'audius', - SENTRY_DSN: 'https://4b15a7a2f2e2459997408b39a0c4942c@s.audius.co/1851611', SOL_BRIDGE_ADDRESS: null, SOL_TOKEN_BRIDGE_ADDRESS: null, SOLANA_CLUSTER_ENDPOINT: 'http://audius-solana-test-validator-1', diff --git a/packages/mobile/src/services/env/env.prod.ts b/packages/mobile/src/services/env/env.prod.ts index 392146d67c2..40ef040d25a 100644 --- a/packages/mobile/src/services/env/env.prod.ts +++ b/packages/mobile/src/services/env/env.prod.ts @@ -64,7 +64,6 @@ export const env: Env = { REWARDS_MANAGER_TOKEN_PDA: '3V9opXNpHmPPymKeq7CYD8wWMH8wzFXmqEkNdzfsZhYq', SAFARI_WEB_PUSH_ID: 'web.co.audius', SCHEME: 'audius', - SENTRY_DSN: 'https://e26d2b01488f4b538ea235de6466c40a@s.audius.co/1457231', SOL_BRIDGE_ADDRESS: 'worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth', SOL_TOKEN_BRIDGE_ADDRESS: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb', SOLANA_CLUSTER_ENDPOINT: diff --git a/packages/mobile/src/services/query-client.ts b/packages/mobile/src/services/query-client.ts index 30ac2235215..73dd9eb7c56 100644 --- a/packages/mobile/src/services/query-client.ts +++ b/packages/mobile/src/services/query-client.ts @@ -2,14 +2,13 @@ import { defaultRetryConfig, queryErrorHandler } from '@audius/common/api' import { QueryCache, QueryClient } from '@tanstack/react-query' import { env } from 'app/services/env' -import { reportToSentry } from 'app/utils/reportToSentry' export const queryClient = new QueryClient({ // In order to have a default error catcher, we need to use a custom query cache // ref: https://tkdodo.eu/blog/react-query-error-handling queryCache: new QueryCache({ onError(error, query) { - queryErrorHandler(error, query, reportToSentry) + queryErrorHandler(error, query) } }), defaultOptions: { diff --git a/packages/mobile/src/services/remote-config/remote-config-instance.ts b/packages/mobile/src/services/remote-config/remote-config-instance.ts index 18f6d59239c..7b6fb80bed6 100644 --- a/packages/mobile/src/services/remote-config/remote-config-instance.ts +++ b/packages/mobile/src/services/remote-config/remote-config-instance.ts @@ -1,4 +1,3 @@ -import { ErrorLevel } from '@audius/common/models' import type { Environment } from '@audius/common/services' import { remoteConfig } from '@audius/common/services' import CodePush from '@bravemobile/react-native-code-push' @@ -9,7 +8,6 @@ import Config from 'react-native-config' import VersionNumber from 'react-native-version-number' import { env } from 'app/services/env' -import { reportToSentry } from 'app/utils/reportToSentry' import packageInfo from '../../../package.json' @@ -60,11 +58,7 @@ export const remoteConfigInstance = remoteConfig({ }, errorHandler: { handleError: (error) => { - reportToSentry({ - level: ErrorLevel.Error, - error, - name: 'Optimizely failed to load' - }) + console.error(error) } } }) diff --git a/packages/mobile/src/store/store.ts b/packages/mobile/src/store/store.ts index d027438b75d..afba1910079 100644 --- a/packages/mobile/src/store/store.ts +++ b/packages/mobile/src/store/store.ts @@ -1,4 +1,3 @@ -import { ErrorLevel } from '@audius/common/models' import type { CommonState, RemoteConfigState } from '@audius/common/store' import { chatMiddleware, @@ -24,7 +23,6 @@ import thunk from 'redux-thunk' import { queryClient } from 'app/services/query-client' import { audiusSdk } from 'app/services/sdk/audius-sdk' -import { reportToSentry } from 'app/utils/reportToSentry' import type { DrawersState } from './drawers/slice' import drawers from './drawers/slice' @@ -83,12 +81,6 @@ const onSagaError = ( }) ) - reportToSentry({ - level: ErrorLevel.Fatal, - error, - additionalInfo: errorInfo - }) - // Automatically restart the app if the session is longer // than 30 seconds. Don't want to restart for shorter sessions // because it could result in a restart loop diff --git a/packages/mobile/src/store/storeContext.ts b/packages/mobile/src/store/storeContext.ts index 1eefd604d57..b8e9b69df7d 100644 --- a/packages/mobile/src/store/storeContext.ts +++ b/packages/mobile/src/store/storeContext.ts @@ -23,7 +23,6 @@ import { signAndSendTransaction } from 'app/store/utils/phantomWalletConnect' import { generatePlaylistArtwork } from 'app/utils/generatePlaylistArtwork' -import { reportToSentry } from 'app/utils/reportToSentry' import share from 'app/utils/share' export const storeContext: CommonStoreContext = { @@ -45,11 +44,6 @@ export const storeContext: CommonStoreContext = { env, explore, nftClient: null, - sentry: { - setTag: () => {}, // Sentry removed - no-op - getCurrentScope: () => ({ setUser: () => {} }) // Sentry removed - no-op - }, - reportToSentry, // Shim in main, but defined in native-reloaded branch audioPlayer, trackDownload, diff --git a/packages/mobile/src/utils/reportToSentry.ts b/packages/mobile/src/utils/reportToSentry.ts deleted file mode 100644 index 103619344b8..00000000000 --- a/packages/mobile/src/utils/reportToSentry.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { ErrorLevel } from '@audius/common/models' -import type { ReportToSentryArgs } from '@audius/common/models' -import { getErrorMessage, isResponseError } from '@audius/common/utils' - -type ConsoleLoggingMethod = keyof Pick< - Console, - 'log' | 'warn' | 'error' | 'info' | 'debug' -> - -const jsLoggerMapping: { [level in ErrorLevel]: ConsoleLoggingMethod } = { - Warning: 'warn', - Fatal: 'error', - Debug: 'debug', - Error: 'error', - Info: 'info', - Log: 'log' -} - -/** - * Helper fn that logs errors to console - * Note: Sentry has been removed from mobile - */ -export const reportToSentry = async ({ - level = ErrorLevel.Error, - additionalInfo, - error, - tags, - name, - feature -}: ReportToSentryArgs) => { - try { - let enrichedAdditionalInfo = additionalInfo - - if (isResponseError(error)) { - const responseBody = - (await error.response.json().catch()) ?? - (await error.response.text().catch()) - enrichedAdditionalInfo = { - ...additionalInfo, - response: error.response, - requestId: error.response.headers.get('X-Request-ID'), - responseBody - } - } - - if (name) { - error.name = `${name}: ${error.name}` - } - - // Call JS console method using the specified level - const consoleMethod = - jsLoggerMapping[level || ErrorLevel.Log] || jsLoggerMapping.Log - // eslint-disable-next-line no-console - console[consoleMethod](error, 'More info in console.debug') - if (enrichedAdditionalInfo || tags || feature) { - console.debug('Additional error info:', { - additionalInfo: enrichedAdditionalInfo, - tags, - feature, - level - }) - } - } catch (err) { - console.error(`Got error trying to log error: ${getErrorMessage(err)}`) - } -} diff --git a/packages/web/package.json b/packages/web/package.json index 0cfdb9444a3..766c62a2444 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -95,7 +95,6 @@ "@reown/appkit-adapter-solana": "1.7.1", "@reown/appkit-adapter-wagmi": "1.7.1", "@reown/appkit-wallet-button": "1.7.1", - "@sentry/browser": "^7.117.0", "@solana/spl-token": "0.3.8", "@solana/web3.js": "1.98.0", "@stripe/crypto": "0.0.4", @@ -159,12 +158,10 @@ "redux": "4.1.1", "redux-persist": "6.0.0", "redux-saga": "1.1.3", - "redux-sentry-middleware": "0.1.8", "redux-thunk": "2.4.2", "reselect": "4.0.0", "semver": "6.3.0", "tar": "6.1.11", - "toucan-js": "3.3.1", "type-fest": "4.26.1", "typed-redux-saga": "1.3.1", "typesafe-actions": "5.1.0", @@ -207,7 +204,6 @@ "@types/react-table": "7.7.12", "@types/react-twitter-auth": "0.0.4", "@types/react-virtualized": "9.21.21", - "@types/redux-sentry-middleware": "0.2.1", "@types/resize-observer-browser": "0.1.7", "@vitejs/plugin-react-swc": "4.2.2", "abort-controller": "3.0.0", diff --git a/packages/web/src/app/AppErrorBoundary.tsx b/packages/web/src/app/AppErrorBoundary.tsx index f7fcfb330e1..429f089c254 100644 --- a/packages/web/src/app/AppErrorBoundary.tsx +++ b/packages/web/src/app/AppErrorBoundary.tsx @@ -1,6 +1,5 @@ import { ReactNode, useCallback } from 'react' -import { ErrorLevel } from '@audius/common/models' import { ErrorBoundary, ErrorBoundaryProps } from 'react-error-boundary' import { useDispatch } from 'react-redux' @@ -22,8 +21,7 @@ export const AppErrorBoundary = ({ children }: AppErrorBoundaryProps) => { name: 'ReactErrorBoundary', message: error.message, shouldRedirect: true, - additionalInfo: errorInfo, - level: ErrorLevel.Fatal + additionalInfo: errorInfo }) ) }, diff --git a/packages/web/src/app/AudiusQueryProvider.tsx b/packages/web/src/app/AudiusQueryProvider.tsx index 7e28673ca77..befbcc3cb0d 100644 --- a/packages/web/src/app/AudiusQueryProvider.tsx +++ b/packages/web/src/app/AudiusQueryProvider.tsx @@ -14,7 +14,6 @@ import { import { env } from 'services/env' import { getFeatureEnabled } from 'services/remote-config/featureFlagHelpers' import { remoteConfigInstance } from 'services/remote-config/remote-config-instance' -import { reportToSentry } from 'store/errors/reportToSentry' import { generatePlaylistArtwork } from 'utils/imageProcessingUtil' type AudiusQueryProviderProps = { @@ -33,7 +32,6 @@ export const AudiusQueryProvider = (props: AudiusQueryProviderProps) => { identityService, solanaWalletService, dispatch, - reportToSentry, env, fetch, remoteConfigInstance, diff --git a/packages/web/src/app/web-player/WebPlayer.tsx b/packages/web/src/app/web-player/WebPlayer.tsx index 8cf115de535..8569ad471a3 100644 --- a/packages/web/src/app/web-player/WebPlayer.tsx +++ b/packages/web/src/app/web-player/WebPlayer.tsx @@ -337,18 +337,6 @@ const validSearchCategories = [ 'playlists' ] -// Lazy load Sentry - initialize on first user interaction or after app loads -if (typeof window !== 'undefined') { - // Initialize Sentry after a short delay to not block initial render - setTimeout(() => { - import('services/sentry').then(({ initializeSentry }) => { - initializeSentry().catch((err) => { - console.error('Failed to initialize Sentry:', err) - }) - }) - }, 100) -} - // Wrapper components for routes that need params or location const SearchCategoryLegacyRedirect = () => { const params = useParams<{ category?: string; query?: string }>() diff --git a/packages/web/src/common/store/pages/audio-rewards/sagas.ts b/packages/web/src/common/store/pages/audio-rewards/sagas.ts index 5d99a9bbcbb..8ee04761564 100644 --- a/packages/web/src/common/store/pages/audio-rewards/sagas.ts +++ b/packages/web/src/common/store/pages/audio-rewards/sagas.ts @@ -8,7 +8,6 @@ import { ChallengeRewardID, SpecifierWithAmount, Name, - Feature, ChallengeName } from '@audius/common/models' import { @@ -54,7 +53,6 @@ import { all } from 'typed-redux-saga' -import { reportToSentry } from 'store/errors/reportToSentry' import { waitForRead } from 'utils/sagaHelpers' import { foregroundPollingDaemon, @@ -358,17 +356,6 @@ function* claimSingleChallengeRewardAsync( ) if (res.error instanceof Errors.AntiAbuseOracleAttestationError) { aaoError = res.error - } else { - yield* call(reportToSentry, { - error, - name: 'ClaimRewards', - additionalInfo: { - challengeId, - specifier: res.specifier, - amount: res.amount - }, - feature: Feature.Rewards - }) } } const errorMessage = 'Some specifiers failed to claim' diff --git a/packages/web/src/common/store/pages/signon/sagas.ts b/packages/web/src/common/store/pages/signon/sagas.ts index 9d1de0b7d88..868b5ef274b 100644 --- a/packages/web/src/common/store/pages/signon/sagas.ts +++ b/packages/web/src/common/store/pages/signon/sagas.ts @@ -16,10 +16,8 @@ import { FavoriteSource, ID, FollowSource, - ErrorLevel, InstagramUser, TikTokUser, - Feature, Status } from '@audius/common/models' import { @@ -72,7 +70,6 @@ import { import { identify, make } from 'common/store/analytics/actions' import { UiErrorCode } from 'store/errors/actions' -import { reportToSentry } from 'store/errors/reportToSentry' import { setHasRequestedBrowserPermission } from 'utils/browserNotifications' import { push as pushRoute } from 'utils/navigation' import { restrictedHandles } from 'utils/restrictedHandles' @@ -156,12 +153,10 @@ function* fetchDefaultFollowArtists() { const defaultFollowUserIds = yield* call(getDefautFollowUserIds) yield* call(queryUsers, Array.from(defaultFollowUserIds)) } catch (e: any) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: e, - name: 'Sign Up: Unable to fetch default follow artists (aka Audius acct)', - feature: Feature.SignUp - }) + console.error( + 'Sign Up: Unable to fetch default follow artists (aka Audius acct)', + e + ) } } @@ -176,12 +171,7 @@ function* fetchReferrer( if (!user) return yield* put(signOnActions.setReferrer(user.user_id)) } catch (e: any) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: e, - name: 'Sign Up: fetchReferrer failed', - feature: Feature.SignUp - }) + console.error('Sign Up: fetchReferrer failed', e) } } } @@ -292,12 +282,7 @@ function* validateHandle( if (onValidate) onValidate(false) } } catch (err: any) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: err, - name: 'Sign Up: validateHandle failed', - feature: Feature.SignUp - }) + console.error('Sign Up: validateHandle failed', err) yield* put(signOnActions.validateHandleFailed(err.message)) if (onValidate) onValidate(true) } @@ -334,13 +319,7 @@ function* checkEmail(action: ReturnType) { } } } catch (error) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: error as Error, - level: ErrorLevel.Error, - name: 'Sign Up: email check failed', - feature: Feature.SignUp - }) + console.error('Sign Up: email check failed', error as Error) yield* put(toast({ content: messages.emailCheckFailed })) if (action.onError) { yield* call(action.onError) @@ -368,13 +347,10 @@ function* sendPostSignInRecoveryEmail({ try { yield* call(sendRecoveryEmail) } catch (err) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: err instanceof Error ? err : new Error(err as string), - name: 'Sign Up: Failed to send recovery email', - additionalInfo: { handle, email }, - feature: Feature.SignUp - }) + console.error( + 'Sign Up: Failed to send recovery email', + err instanceof Error ? err : new Error(err as string) + ) } } @@ -382,7 +358,6 @@ function* createGuestAccount( action: ReturnType ) { const { guestEmail } = action - const reportToSentry = yield* getContext('reportToSentry') const localStorage = yield* getContext('localStorage') const audiusBackendInstance = yield* getContext('audiusBackendInstance') const queryClient = yield* getContext('queryClient') @@ -444,19 +419,13 @@ function* createGuestAccount( }, () => {}, function* ({ error: err }: { error: Error }) { - reportToSentry({ - error: err as Error, - level: ErrorLevel.Fatal, - name: 'Sign Up: Failed to create guest account', - feature: Feature.SignUp - }) + console.error('Sign Up: Failed to create guest account', err as Error) } ) ) } function* signUp() { - const reportToSentry = yield* getContext('reportToSentry') const localStorage = yield* getContext('localStorage') const queryClient = yield* getContext('queryClient') @@ -482,18 +451,8 @@ function* signUp() { confirmerActions.requestConfirmation( handle, function* () { - const reportToSentry = yield* getContext('reportToSentry') const isNativeMobile = yield* getContext('isNativeMobile') - const createUserMetadata = { - name, - handle, - profilePicture: (signOn.profileImage?.file as File) || null, - coverPhoto: (signOn.coverPhoto?.file as File) || null, - isVerified: signOn.verified, - location - } - let userId: ID try { if (isGuest) { @@ -700,19 +659,7 @@ function* signUp() { location }) ) - reportToSentry({ - error, - level: ErrorLevel.Warning, - name: 'Sign Up: User rate limited', - additionalInfo: { - handle, - email, - location, - formFields: createUserMetadata, - hasWallet: alreadyExisted - }, - feature: Feature.SignUp - }) + console.error(error) } else if (blocked) { params.message = 'User was blocked' params.uiErrorCode = UiErrorCode.RELAY_BLOCKED @@ -723,32 +670,9 @@ function* signUp() { location }) ) - reportToSentry({ - error, - level: ErrorLevel.Warning, - name: 'Sign Up: User was blocked', - additionalInfo: { - handle, - email, - location, - formFields: createUserMetadata, - hasWallet: alreadyExisted - }, - feature: Feature.SignUp - }) + console.error(error) } else { - reportToSentry({ - error, - name: 'Sign Up: Other Error', - additionalInfo: { - handle, - email, - location, - formFields: createUserMetadata, - hasWallet: alreadyExisted - }, - feature: Feature.SignUp - }) + console.error(error) } yield* put(signOnActions.signUpFailed(params)) } @@ -780,13 +704,7 @@ function* signUp() { yield* put(signOnActions.signUpTimeout()) } if (error) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error, - name: 'Sign Up: Unknown error in signUp saga', - additionalInfo: { message, timeout }, - feature: Feature.SignUp - }) + console.error(error) } if (message) { console.debug(message) @@ -797,11 +715,7 @@ function* signUp() { ) ) } catch (error) { - reportToSentry({ - error: error as Error, - name: 'Sign Up: Unknown error in signUp saga', - feature: Feature.SignUp - }) + console.error('Sign Up: Unknown error in signUp saga', error as Error) } } @@ -877,9 +791,7 @@ function* signIn(action: ReturnType) { ) yield* put(make(Name.SIGN_IN_WITH_INCOMPLETE_ACCOUNT, { handle: '' })) - yield* call(reportToSentry, { - error: new Error('Failed to fetch account') - }) + console.error('Failed to fetch account') yield* put(toastActions.toast({ content: messages.incompleteAccount })) yield* put( @@ -1011,12 +923,7 @@ function* signIn(action: ReturnType) { } } } catch (err: any) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: err, - name: 'Sign In: unknown error', - feature: Feature.SignIn - }) + console.error('Sign In: unknown error', err) yield* put(signOnActions.signInFailed(err)) } } @@ -1031,13 +938,7 @@ function* followCollections( yield* put(saveCollection(collectionId, favoriteSource)) } } catch (err) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: err as Error, - name: 'Sign Up: Follow collections failed', - additionalInfo: { collectionIds, favoriteSource }, - feature: Feature.SignUp - }) + console.error('Sign Up: Follow collections failed', err as Error) } } @@ -1102,17 +1003,10 @@ function* followArtists( }) const followAction = success || failed if (failed) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: new Error(failed.error), - name: 'Sign Up: Artist follow failed during sign up', - additionalInfo: { - userId: failed.userId, - userIdsToFollow, - skipDefaultFollows - }, - feature: Feature.SignUp - }) + console.error( + 'Sign Up: Artist follow failed during sign up', + new Error(failed.error) + ) } const userIndex = userIdsToFollow.findIndex( (fId) => fId === followAction?.userId @@ -1126,12 +1020,10 @@ function* followArtists( // So we wait until both the user is indexed and the follow user actions are finished yield* call(audiusBackendInstance.updateUserLocationTimezone, { sdk }) } catch (err: any) { - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: err, - name: 'Sign Up: Unkown error while following artists on sign up', - feature: Feature.SignUp - }) + console.error( + 'Sign Up: Unkown error while following artists on sign up', + err + ) } } diff --git a/packages/web/src/common/store/pages/track/sagas.ts b/packages/web/src/common/store/pages/track/sagas.ts index a80c68d8a24..f746490ed6f 100644 --- a/packages/web/src/common/store/pages/track/sagas.ts +++ b/packages/web/src/common/store/pages/track/sagas.ts @@ -7,8 +7,7 @@ import { queryTrack, updateTrackData } from '@audius/common/api' -import { Feature } from '@audius/common/models' -import { getContext, getSDK, trackPageActions } from '@audius/common/store' +import { getSDK, trackPageActions } from '@audius/common/store' import { dayjs } from '@audius/common/utils' import { Id, OptionalId } from '@audius/sdk' import { call, takeEvery } from 'typed-redux-saga' @@ -70,13 +69,10 @@ function* watchTrackPageMakePublic() { } catch (error) { // Roll back the optimistic update. yield* call(updateTrackData, [track]) - const reportToSentry = yield* getContext('reportToSentry') - reportToSentry({ - error: error instanceof Error ? error : new Error(String(error)), - name: 'Make Track Public', - additionalInfo: { trackId }, - feature: Feature.Edit - }) + console.error( + 'Make Track Public', + error instanceof Error ? error : new Error(String(error)) + ) } } ) diff --git a/packages/web/src/common/store/playback/errorSagas.ts b/packages/web/src/common/store/playback/errorSagas.ts index 38219c11d18..694a47e8a0c 100644 --- a/packages/web/src/common/store/playback/errorSagas.ts +++ b/packages/web/src/common/store/playback/errorSagas.ts @@ -1,4 +1,3 @@ -import { Feature } from '@audius/common/models' import { playbackActions } from '@audius/common/store' import { createErrorSagas } from 'utils/errorSagas' @@ -15,8 +14,7 @@ const errorSagas = createErrorSagas({ error: action.error, trackId: action.trackId, info: action.info - }), - feature: Feature.Playback + }) }) export default errorSagas diff --git a/packages/web/src/common/store/playback/sagas.ts b/packages/web/src/common/store/playback/sagas.ts index 9feb969dac1..164181d547f 100644 --- a/packages/web/src/common/store/playback/sagas.ts +++ b/packages/web/src/common/store/playback/sagas.ts @@ -9,7 +9,6 @@ import { queryUser } from '@audius/common/api' import { - Feature, Kind, Name, PlaybackSource as AnalyticsPlaybackSource, @@ -498,8 +497,7 @@ function* handleAudioErrors() { playbackActions.error({ error, trackId, - info: data, - feature: Feature.Playback + info: data }) ) } diff --git a/packages/web/src/common/store/social/collections/errorSagas.ts b/packages/web/src/common/store/social/collections/errorSagas.ts index ea3a5512458..06345ed7987 100644 --- a/packages/web/src/common/store/social/collections/errorSagas.ts +++ b/packages/web/src/common/store/social/collections/errorSagas.ts @@ -1,4 +1,3 @@ -import { Feature } from '@audius/common/models' import { collectionsSocialActions as socialCollectionActions } from '@audius/common/store' import { createErrorSagas } from 'utils/errorSagas' @@ -18,8 +17,7 @@ const errorSagas = createErrorSagas({ getAdditionalInfo: (action: CollectionErrors) => ({ error: action.error, collectionId: action.collectionId - }), - feature: Feature.Social + }) }) export default errorSagas diff --git a/packages/web/src/common/store/social/tracks/errorSagas.ts b/packages/web/src/common/store/social/tracks/errorSagas.ts index 66246dec94f..c21a0b89838 100644 --- a/packages/web/src/common/store/social/tracks/errorSagas.ts +++ b/packages/web/src/common/store/social/tracks/errorSagas.ts @@ -1,4 +1,3 @@ -import { Feature } from '@audius/common/models' import { tracksSocialActions as socialTrackActions } from '@audius/common/store' import { createErrorSagas } from 'utils/errorSagas' @@ -19,8 +18,7 @@ const errorSagas = createErrorSagas({ getAdditionalInfo: (action: TrackRepostErrors) => ({ error: action.error, trackId: action.trackId - }), - feature: Feature.Social + }) }) export default errorSagas diff --git a/packages/web/src/common/store/social/users/errorSagas.ts b/packages/web/src/common/store/social/users/errorSagas.ts index 2379d62efb6..ae21f2eb62c 100644 --- a/packages/web/src/common/store/social/users/errorSagas.ts +++ b/packages/web/src/common/store/social/users/errorSagas.ts @@ -1,4 +1,3 @@ -import { Feature } from '@audius/common/models' import { usersSocialActions as socialUserActions } from '@audius/common/store' import { createErrorSagas } from 'utils/errorSagas' @@ -19,8 +18,7 @@ const errorSagas = createErrorSagas({ getAdditionalInfo: (action: UserErrors) => ({ error: action.error, userId: action.userId - }), - feature: Feature.Social + }) }) export default errorSagas diff --git a/packages/web/src/components/error-wrapper/ErrorWrapper.tsx b/packages/web/src/components/error-wrapper/ErrorWrapper.tsx index a4e8202c14b..f330763d6b1 100644 --- a/packages/web/src/components/error-wrapper/ErrorWrapper.tsx +++ b/packages/web/src/components/error-wrapper/ErrorWrapper.tsx @@ -10,16 +10,13 @@ class ErrorWrapper extends PureComponent { didError: false } - async componentDidCatch(error: Error | null, errorInfo: object) { + componentDidCatch(error: Error | null, _errorInfo: object) { this.setState({ didError: true }) - try { - // Lazy load Sentry SDK - const Sentry = await import('@sentry/browser') - const { errorMessage } = this.props - if (errorMessage) Sentry.captureMessage(errorMessage) - Sentry.captureException(error) - } catch (err) { - console.error('Failed to report error to Sentry:', err) + const { errorMessage } = this.props + if (errorMessage) { + console.error(errorMessage, error) + } else { + console.error(error) } } diff --git a/packages/web/src/components/error-wrapper/componentWithErrorBoundary.tsx b/packages/web/src/components/error-wrapper/componentWithErrorBoundary.tsx index 16b2fd78441..5fca9a30989 100644 --- a/packages/web/src/components/error-wrapper/componentWithErrorBoundary.tsx +++ b/packages/web/src/components/error-wrapper/componentWithErrorBoundary.tsx @@ -1,6 +1,5 @@ import React, { ReactNode, useCallback } from 'react' -import { ErrorLevel } from '@audius/common/models' import { ErrorBoundary, ErrorBoundaryProps, @@ -40,8 +39,7 @@ export function componentWithErrorBoundary

( name: `ComponentErrorBoundary: ${name}`, message: error.message, shouldRedirect: false, - additionalInfo: errorInfo, - level: ErrorLevel.Error + additionalInfo: errorInfo }) ) }, diff --git a/packages/web/src/components/instagram-auth/InstagramAuth.tsx b/packages/web/src/components/instagram-auth/InstagramAuth.tsx index 078b3c49bb4..3b5cc436980 100644 --- a/packages/web/src/components/instagram-auth/InstagramAuth.tsx +++ b/packages/web/src/components/instagram-auth/InstagramAuth.tsx @@ -1,13 +1,10 @@ import { MouseEvent, ReactNode, useCallback } from 'react' -import { Feature } from '@audius/common/models' import cn from 'classnames' import 'url-search-params-polyfill' import { audiusBackendInstance } from 'services/audius-backend/audius-backend-instance' import { env } from 'services/env' -import { reportToSentry } from 'store/errors/reportToSentry' - const HOSTNAME = env.PUBLIC_HOSTNAME const INSTAGRAM_APP_ID = env.INSTAGRAM_APP_ID const INSTAGRAM_REDIRECT_URL = env.INSTAGRAM_REDIRECT_URL || '' @@ -92,12 +89,7 @@ const InstagramAuth = ({ return onSuccess(profileRespJson.username, igUserProfile) } catch (err: any) { - reportToSentry({ - error: err, - name: 'Sign Up: InstagramAuth getProfile failed', - tags: { socialMedia: 'instagram' }, - feature: Feature.SignUp - }) + console.error('Sign Up: InstagramAuth getProfile failed', err) onFailure(err) } }, @@ -137,12 +129,7 @@ const InstagramAuth = ({ 'They were either not set during the redirect, or were removed—typically by a ' + 'routing library—before Instagram react component could read it.' ) - reportToSentry({ - error, - name: 'Sign Up: InstagramAuth oauth redirect failed', - feature: Feature.SignUp, - tags: { socialMedia: 'instagram' } - }) + console.error(error) return onFailure(error) } } @@ -159,12 +146,7 @@ const InstagramAuth = ({ const popup = openPopup() await new Promise((resolve) => setTimeout(resolve, 500)) // wait 500ms if (!popup) { - reportToSentry({ - error: new Error('Unable to open InstagramAuth popup'), - name: 'Sign Up', - feature: Feature.SignUp, - tags: { socialMedia: 'instagram' } - }) + console.error('Sign Up', new Error('Unable to open InstagramAuth popup')) } try { if (popup) { @@ -174,12 +156,10 @@ const InstagramAuth = ({ polling(popup) } } catch (error) { - reportToSentry({ - error: error as Error, - name: 'Sign Up: InstagramAuth popup polling failed', - feature: Feature.SignUp, - tags: { socialMedia: 'instagram' } - }) + console.error( + 'Sign Up: InstagramAuth popup polling failed', + error as Error + ) if (popup) popup.close() return onFailure(error) } diff --git a/packages/web/src/components/payout-wallet-modal/PayoutWalletModal.tsx b/packages/web/src/components/payout-wallet-modal/PayoutWalletModal.tsx index 4930c0d1e07..33704cee652 100644 --- a/packages/web/src/components/payout-wallet-modal/PayoutWalletModal.tsx +++ b/packages/web/src/components/payout-wallet-modal/PayoutWalletModal.tsx @@ -44,8 +44,6 @@ import { ModalForm } from 'components/modal-form/ModalForm' import { audiusSdk } from 'services/audius-sdk' import { env } from 'services/env' import { getAssociatedTokenAccountOwner } from 'services/solana/solana' -import { reportToSentry } from 'store/errors/reportToSentry' - const messages = { title: 'Payout Wallet', body: 'Automatically send USDC earned on Audius to an external Solana wallet.', @@ -310,10 +308,7 @@ export const PayoutWalletModal = NiceModal.create(() => { modal.hide() } catch (e) { setErrors({ address: 'Please try again later' }) - await reportToSentry({ - error: e as Error, - name: 'Payout Wallet: Error setting wallet' - }) + await console.error('Payout Wallet: Error setting wallet', e as Error) } setIsSubmitting(false) }, diff --git a/packages/web/src/components/send-tokens-modal/SendTokensModal.tsx b/packages/web/src/components/send-tokens-modal/SendTokensModal.tsx index 9f02574e9b5..ea4e74e01c5 100644 --- a/packages/web/src/components/send-tokens-modal/SendTokensModal.tsx +++ b/packages/web/src/components/send-tokens-modal/SendTokensModal.tsx @@ -2,18 +2,12 @@ import { useCallback, useState, useEffect, useRef } from 'react' import { useSendCoins } from '@audius/common/api' import { walletMessages } from '@audius/common/messages' -import { - ErrorLevel, - Feature, - SolanaWalletAddress, - User -} from '@audius/common/models' +import { SolanaWalletAddress, User } from '@audius/common/models' import { registerNiceModalId } from '@audius/common/services' import { useSendTokensModal } from '@audius/common/store' import NiceModal, { useModal } from '@ebay/nice-modal-react' import ResponsiveModal from 'components/modal/ResponsiveModal' -import { reportToSentry } from 'store/errors/reportToSentry' import SendTokensConfirmation from './SendTokensConfirmation' import SendTokensFailure from './SendTokensFailure' @@ -186,17 +180,7 @@ const SendTokensModal = NiceModal.create(() => { } setError(errorMessage) - reportToSentry({ - level: ErrorLevel.Error, - error: error as Error, - additionalInfo: { - amount: state.amount.toString(), - destinationAddress: state.destinationAddress, - mint: state.selectedMint, - errorString - }, - feature: Feature.SendTokens - }) + console.error(error as Error) setState((prev) => ({ ...prev, step: 'failure' })) } } diff --git a/packages/web/src/components/x-auth/XAuthButton.tsx b/packages/web/src/components/x-auth/XAuthButton.tsx index 9258a5aa248..9b0d571701f 100644 --- a/packages/web/src/components/x-auth/XAuthButton.tsx +++ b/packages/web/src/components/x-auth/XAuthButton.tsx @@ -3,13 +3,10 @@ import { MouseEventHandler } from 'react' import 'whatwg-fetch' import 'url-search-params-polyfill' -import { Feature } from '@audius/common/models' import { TwitterProfile } from '@audius/common/store' import { SocialButton } from '@audius/harmony' import { audiusBackendInstance } from 'services/audius-backend/audius-backend-instance' -import { reportToSentry } from 'store/errors/reportToSentry' - const REQUEST_TOKEN_URL = `${audiusBackendInstance.identityServiceUrl}/twitter` as const const LOGIN_URL = @@ -81,13 +78,10 @@ export const XAuthButton = (props: XAuthButtonProps) => { }) .catch((error) => { popup?.close() - reportToSentry({ - error: error as Error, - additionalInfo: { authenticationUrl, screenName }, - tags: { socialMedia: 'twitter' }, - name: 'Sign Up: Twitter getRequestToken popup failed', - feature: Feature.SignUp - }) + console.error( + 'Sign Up: Twitter getRequestToken popup failed', + error as Error + ) return onFailure(error) }) } @@ -135,13 +129,7 @@ export const XAuthButton = (props: XAuthButtonProps) => { 'They were either not set during the redirect, or were removed—typically by a ' + 'routing library—before Twitter react component could read it.' ) - reportToSentry({ - error, - additionalInfo: { popupLocation: popup.location }, - tags: { socialMedia: 'twitter' }, - name: 'Sign Up: Twitter oauth redirect failed', - feature: Feature.SignUp - }) + console.error(error) return onFailure(error) } } @@ -169,12 +157,7 @@ export const XAuthButton = (props: XAuthButtonProps) => { response.json().then(({ uuid, profile }) => onSuccess(uuid, profile)) }) .catch((error) => { - reportToSentry({ - error: error as Error, - tags: { socialMedia: 'twitter' }, - name: 'Sign Up: Twitter getOauthToken failed', - feature: Feature.SignUp - }) + console.error('Sign Up: Twitter getOauthToken failed', error as Error) return onFailure(error) }) } diff --git a/packages/web/src/hooks/useClaimFees.ts b/packages/web/src/hooks/useClaimFees.ts index 0f78df51921..5912a0cd302 100644 --- a/packages/web/src/hooks/useClaimFees.ts +++ b/packages/web/src/hooks/useClaimFees.ts @@ -4,7 +4,6 @@ import { useQueryContext, pollUntilAudioBalanceChanges } from '@audius/common/api' -import { Feature } from '@audius/common/models' import { createUserBankIfNeeded } from '@audius/common/services' import type { Provider as SolanaProvider } from '@reown/appkit-adapter-solana/react' import { VersionedTransaction } from '@solana/web3.js' @@ -16,8 +15,6 @@ import { import { appkitModal } from 'app/ReownAppKitModal' import { track } from 'services/analytics' -import { reportToSentry } from 'store/errors/reportToSentry' - export type UseClaimFeesParams = { tokenMint: string externalWalletAddress: string @@ -95,14 +92,7 @@ export const useClaimFees = ( ...options, onError: (error, params) => { // Call the original onError if provided - reportToSentry({ - error, - feature: Feature.FanClubs, - name: 'Fan club fees claim error', - additionalInfo: { - ...params - } - }) + console.error(error) }, onSuccess: async (data, variables, context) => { // Invalidate the fan club query to refetch the updated fees diff --git a/packages/web/src/hooks/useClaimVestedCoins.ts b/packages/web/src/hooks/useClaimVestedCoins.ts index b29439a30ae..fcfd6d6cbae 100644 --- a/packages/web/src/hooks/useClaimVestedCoins.ts +++ b/packages/web/src/hooks/useClaimVestedCoins.ts @@ -6,7 +6,6 @@ import { useQueryContext, QUERY_KEYS } from '@audius/common/api' -import { Feature } from '@audius/common/models' import type { UserCoinWithAccounts } from '@audius/sdk' import type { Provider as SolanaProvider } from '@reown/appkit-adapter-solana/react' import { PublicKey, VersionedTransaction } from '@solana/web3.js' @@ -17,8 +16,6 @@ import { } from '@tanstack/react-query' import { appkitModal } from 'app/ReownAppKitModal' -import { reportToSentry } from 'store/errors/reportToSentry' - export type UseClaimVestedCoinsParams = { tokenMint: string externalWalletAddress: string @@ -124,14 +121,7 @@ export const useClaimVestedCoins = ( }, ...options, onError: (error, params) => { - reportToSentry({ - error, - feature: Feature.FanClubs, - name: 'Fan club vested coins claim error', - additionalInfo: { - ...params - } - }) + console.error(error) options?.onError?.(error, params, undefined) }, onSuccess: (data: ClaimVestedCoinsResult, variables, context) => { diff --git a/packages/web/src/hooks/useConnectExternalWallets.ts b/packages/web/src/hooks/useConnectExternalWallets.ts index 7323b944c00..5f4f5dd2ff6 100644 --- a/packages/web/src/hooks/useConnectExternalWallets.ts +++ b/packages/web/src/hooks/useConnectExternalWallets.ts @@ -1,7 +1,7 @@ import { useState, useCallback, useEffect, useRef } from 'react' import { useCurrentAccountUser } from '@audius/common/api' -import { Name, Chain, Feature } from '@audius/common/models' +import { Name, Chain } from '@audius/common/models' import { isLightTheme } from '@audius/harmony' import { useTheme } from '@emotion/react' import type { NamespaceTypeMap } from '@reown/appkit' @@ -15,8 +15,6 @@ import { useSwitchAccount, useAccount } from 'wagmi' import { appkitModal, audiusChain } from 'app/ReownAppKitModal' import { useRecord, make } from 'common/store/analytics/actions' -import { reportToSentry } from 'store/errors/reportToSentry' - /** * Error when trying to associate a wallet that was already associated */ @@ -160,11 +158,10 @@ export const useConnectExternalWallets = ( ) } if (!solAddress && !ethAddress) { - reportToSentry({ - error: new Error('No wallets found to connect'), - name: 'Connect Wallet Error', - feature: Feature.FanClubs - }) + console.error( + 'Connect Wallet Error', + new Error('No wallets found to connect') + ) } setCurrentWallets({ @@ -184,14 +181,7 @@ export const useConnectExternalWallets = ( error: String(event.data) }) ) - reportToSentry({ - error: new Error('Connect Wallet Error'), - name: 'Connect Wallet Error', - feature: Feature.FanClubs, - additionalInfo: { - error: String(event.data) - } - }) + console.error('Connect Wallet Error', new Error('Connect Wallet Error')) onError?.(event) } }) diff --git a/packages/web/src/hooks/useExternalWalletSwap.ts b/packages/web/src/hooks/useExternalWalletSwap.ts index b06a8f88c72..205c8d78e01 100644 --- a/packages/web/src/hooks/useExternalWalletSwap.ts +++ b/packages/web/src/hooks/useExternalWalletSwap.ts @@ -10,7 +10,6 @@ import { SwapTokensResult, getConnectedWalletsQueryOptions } from '@audius/common/api' -import { ErrorLevel, Feature } from '@audius/common/models' import { getJupiterQuoteByMintWithRetry, jupiterInstance @@ -28,8 +27,6 @@ import { import { useMutation, useQueryClient } from '@tanstack/react-query' import { appkitModal } from 'app/ReownAppKitModal' -import { reportToSentry } from 'store/errors/reportToSentry' - type BaseSwapParams = { walletAddress: string } @@ -631,10 +628,8 @@ export const useExternalWalletSwap = () => { // Determine error type based on progress let errorType = SwapErrorType.UNKNOWN let errorStage = 'UNKNOWN' - let userCancelled = false if (errorMessage.includes('User rejected')) { - userCancelled = true hookProgress.userCancelled = true errorType = SwapErrorType.WALLET_ERROR errorStage = 'USER_REJECTED' @@ -652,18 +647,10 @@ export const useExternalWalletSwap = () => { errorStage = 'SENDING_TRANSACTION' } - reportToSentry({ - error: error instanceof Error ? error : new Error(errorMessage), - level: ErrorLevel.Error, - feature: Feature.FanClubs, - name: 'External Wallet Swap Error', - additionalInfo: { - ...params, - progress: hookProgress, - errorStage, - userCancelled - } - }) + console.error( + 'External Wallet Swap Error', + error instanceof Error ? error : new Error(errorMessage) + ) return { status: SwapStatus.ERROR, diff --git a/packages/web/src/hooks/useLaunchCoin.ts b/packages/web/src/hooks/useLaunchCoin.ts index 083b5e96e57..63cf9bcc5f4 100644 --- a/packages/web/src/hooks/useLaunchCoin.ts +++ b/packages/web/src/hooks/useLaunchCoin.ts @@ -7,7 +7,6 @@ import { useQueryContext } from '@audius/common/api' import { - Feature, LaunchCoinErrorMetadata, LaunchCoinResponse } from '@audius/common/models' @@ -41,7 +40,7 @@ export const LAUNCHPAD_COIN_DECIMALS = 9 // All our launched coins will have 9 d * This creates a new token and optionally makes an initial purchase. */ export const useLaunchCoin = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const queryClient = useQueryClient() return useMutation({ @@ -154,14 +153,10 @@ export const useLaunchCoin = () => { ? 'firstBuyConfirmed' : 'poolCreateConfirmed' } catch (e) { - if (reportToSentry) { - reportToSentry({ - error: e instanceof Error ? e : new Error(e as string), - name: 'Confirm Launch Failure', - feature: Feature.FanClubs, - additionalInfo: errorMetadata - }) - } + console.error( + 'Confirm Launch Failure', + e instanceof Error ? e : new Error(e as string) + ) throw e } @@ -236,14 +231,10 @@ export const useLaunchCoin = () => { errorMetadata.sdkCoinAdded = true errorMetadata.lastStep = 'sdkCoinAdded' } catch (e) { - if (reportToSentry) { - reportToSentry({ - error: e instanceof Error ? e : new Error(e as string), - name: 'SDK Create Coin Failure', - feature: Feature.FanClubs, - additionalInfo: errorMetadata - }) - } + console.error( + 'SDK Create Coin Failure', + e instanceof Error ? e : new Error(e as string) + ) } return { @@ -253,14 +244,10 @@ export const useLaunchCoin = () => { errorMetadata } } catch (error) { - if (reportToSentry) { - reportToSentry({ - error: error instanceof Error ? error : new Error(error as string), - name: 'Launch Coin Failure', - feature: Feature.FanClubs, - additionalInfo: errorMetadata - }) - } + console.error( + 'Launch Coin Failure', + error instanceof Error ? error : new Error(error as string) + ) return { isError: true, errorMetadata, newMint: '', logoUri: '' } } }, @@ -288,18 +275,10 @@ export const useLaunchCoin = () => { }) }, onError: (error, params, _context) => { - if (reportToSentry) { - reportToSentry({ - error: error instanceof Error ? error : new Error(error as string), - name: 'Launch Coin', - feature: Feature.TanQuery, - additionalInfo: { - coinName: params.name, - coinSymbol: params.symbol, - initialBuyAmount: params.initialBuyAmountAudio ?? 0 - } - }) - } + console.error( + 'Launch Coin', + error instanceof Error ? error : new Error(error as string) + ) } }) } diff --git a/packages/web/src/pages/audio-page/components/modals/ConnectedWalletsModal.tsx b/packages/web/src/pages/audio-page/components/modals/ConnectedWalletsModal.tsx index b38048c0181..6ed63bcf810 100644 --- a/packages/web/src/pages/audio-page/components/modals/ConnectedWalletsModal.tsx +++ b/packages/web/src/pages/audio-page/components/modals/ConnectedWalletsModal.tsx @@ -23,7 +23,6 @@ import NiceModal, { useModal } from '@ebay/nice-modal-react' import Drawer from 'components/drawer/Drawer' import { ToastContext } from 'components/toast/ToastContext' import { useIsMobile } from 'hooks/useIsMobile' -import { reportToSentry } from 'store/errors/reportToSentry' import { NEW_WALLET_CONNECTED_TOAST_TIMEOUT_MILLIS } from 'utils/constants' import { @@ -113,20 +112,7 @@ export const ConnectedWalletsModal = NiceModal.create(() => { toast(messages.walletAlreadyAdded) } else { toast(messages.error) - await reportToSentry({ - name: 'ConnectWallet', - error: - e instanceof Error - ? e - : new Error( - e instanceof Object && 'message' in e - ? (e.message as string) - : 'Unknown Error' - ), - additionalInfo: { - raw: e - } - }) + await console.error('ConnectWallet', e instanceof Error) } }, [toast] diff --git a/packages/web/src/pages/edit-coin-details-page/EditCoinDetailsPage.tsx b/packages/web/src/pages/edit-coin-details-page/EditCoinDetailsPage.tsx index 38822e7d87d..0012d11af60 100644 --- a/packages/web/src/pages/edit-coin-details-page/EditCoinDetailsPage.tsx +++ b/packages/web/src/pages/edit-coin-details-page/EditCoinDetailsPage.tsx @@ -47,7 +47,6 @@ import { TextAreaField, TextField } from 'components/form-fields' import { Header } from 'components/header/desktop/Header' import Page from 'components/page/Page' import { useCoverPhoto } from 'hooks/useCoverPhoto' -import { reportToSentry } from 'store/errors/reportToSentry' import { ALLOWED_IMAGE_FILE_TYPES, resizeImage @@ -346,10 +345,10 @@ export const EditCoinDetailsPage = () => { const previewUrl = URL.createObjectURL(processedFile) setBannerPreviewUrl(previewUrl) } catch (error) { - reportToSentry({ - error: error instanceof Error ? error : new Error(error as string), - name: 'Coin Banner Upload Processing Error' - }) + console.error( + 'Coin Banner Upload Processing Error', + error instanceof Error ? error : new Error(error as string) + ) setBannerError(bannerMessages.errors.processingError) } finally { setIsProcessingBanner(false) @@ -389,20 +388,7 @@ export const EditCoinDetailsPage = () => { ? e.message : 'Failed to update coin details. Please try again.' setSubmitError(errorMessage) - await reportToSentry({ - name: 'EditCoinDetails', - error: - e instanceof Error - ? e - : new Error( - e instanceof Object && 'message' in e - ? (e.message as string) - : 'Unknown Error' - ), - additionalInfo: { - raw: e - } - }) + await console.error('EditCoinDetails', e instanceof Error) throw e // Re-throw to let Formik handle the error } } diff --git a/packages/web/src/pages/fan-club-detail-page/components/FanClubInfoSection.tsx b/packages/web/src/pages/fan-club-detail-page/components/FanClubInfoSection.tsx index 582ff696700..24250500040 100644 --- a/packages/web/src/pages/fan-club-detail-page/components/FanClubInfoSection.tsx +++ b/packages/web/src/pages/fan-club-detail-page/components/FanClubInfoSection.tsx @@ -12,7 +12,7 @@ import { useIsManagedAccount } from '@audius/common/hooks' import { coinDetailsMessages, walletMessages } from '@audius/common/messages' -import { Feature, Name, WidthSizes } from '@audius/common/models' +import { Name, WidthSizes } from '@audius/common/models' import { useClaimVestedCoinsModal } from '@audius/common/store' import { formatCurrencyWithSubscript, @@ -63,7 +63,6 @@ import { useConnectExternalWallets } from 'hooks/useConnectExternalWallets' import { useCoverPhoto } from 'hooks/useCoverPhoto' import { useIsMobile } from 'hooks/useIsMobile' import { env } from 'services/env' -import { reportToSentry } from 'store/errors/reportToSentry' import { push } from 'utils/navigation' const { REWARDS_PAGE, UPLOAD_PAGE } = route @@ -589,17 +588,7 @@ export const FanClubInfoSection = ({ ) }, onError: (error) => { - reportToSentry({ - error, - feature: Feature.FanClubs, - name: 'Failed to claim fan club fees', - additionalInfo: { - coin, - tokenMint: mint, - unclaimedFees, - totalArtistEarnings - } - }) + console.error(error) console.error(error) toast(toastMessages.feesClaimFailed) record( @@ -630,15 +619,7 @@ export const FanClubInfoSection = ({ ) }, onError: (error) => { - reportToSentry({ - error, - feature: Feature.FanClubs, - name: 'Failed to claim vested fan clubs', - additionalInfo: { - coin, - tokenMint: mint - } - }) + console.error(error) console.error(error) toast(toastMessages.vestedCoinsClaimFailed) record( diff --git a/packages/web/src/pages/fan-clubs-launchpad-page/LaunchpadPage.tsx b/packages/web/src/pages/fan-clubs-launchpad-page/LaunchpadPage.tsx index 37f4f9f52a3..a5d9ab0daf8 100644 --- a/packages/web/src/pages/fan-clubs-launchpad-page/LaunchpadPage.tsx +++ b/packages/web/src/pages/fan-clubs-launchpad-page/LaunchpadPage.tsx @@ -11,8 +11,6 @@ import { useFeatureFlag } from '@audius/common/hooks' import { launchpadMessages } from '@audius/common/messages' import { Chain, - ErrorLevel, - Feature, Name, LaunchpadFormValues, WidthSizes @@ -43,7 +41,6 @@ import { useCoverPhoto } from 'hooks/useCoverPhoto' import { useExternalWalletSwap } from 'hooks/useExternalWalletSwap' import { LAUNCHPAD_COIN_DECIMALS, useLaunchCoin } from 'hooks/useLaunchCoin' import { make, track } from 'services/analytics' -import { reportToSentry } from 'store/errors/reportToSentry' import { ConnectedWalletHeader } from './components' import { @@ -69,13 +66,6 @@ const messages = { } } -const sanitizeFormValuesForLogging = ( - values: LaunchpadFormValues -): Omit => { - const { coinImage: _coinImageIgnored, ...rest } = values - return rest -} - /** * Fetches an image from a URL and converts it to a File object * Used to copy the user's cover photo for the coin banner @@ -176,15 +166,10 @@ const LaunchpadPageContent = ({ const { solana: connectedWallet } = newWallets if (!connectedWallet) { alert(messages.errors.noSolanaWalletFound) - reportToSentry({ - error: new Error(messages.errors.noSolanaWalletFound), - name: 'Launchpad Page', - feature: Feature.FanClubs, - additionalInfo: { - newWallets, - externalWalletAccount - } - }) + console.error( + 'Launchpad Page', + new Error(messages.errors.noSolanaWalletFound) + ) return } @@ -213,21 +198,15 @@ const LaunchpadPageContent = ({ } } catch (error) { alert(messages.errors.failedToCheckWalletBalance) - reportToSentry({ - error: error instanceof Error ? error : new Error(error as string), - name: 'Launchpad Page', - feature: Feature.FanClubs, - additionalInfo: { - newWallets, - externalWalletAccount - } - }) + console.error( + 'Launchpad Page', + error instanceof Error ? error : new Error(error as string) + ) } }, [ queryClient, queryContext, - externalWalletAccount, trackWalletConnectSuccess, trackWalletInsufficientBalance, handleWalletAddSuccess @@ -560,18 +539,12 @@ export const LaunchpadPage = () => { toast(messages.errors.unknownError, Infinity, { rightIcon: IconClose }) - reportToSentry({ - error: new Error( + console.error( + 'Launchpad Submit Error', + new Error( 'Unable to submit launchpad form. No user or connected wallet found' - ), - name: 'Launchpad Submit Error', - feature: Feature.FanClubs, - additionalInfo: { - currentUser, - connectedWalletAddress, - formValues: sanitizeFormValuesForLogging(formValues) - } - }) + ) + ) throw new Error('No user or connected wallet found') } @@ -606,17 +579,12 @@ export const LaunchpadPage = () => { toast(messages.errors.unknownError, Infinity, { rightIcon: IconClose }) - reportToSentry({ - error: new Error( + console.error( + 'First Buy Retry Failure', + new Error( 'First buy retry failed. No mint address or pay amount found.' - ), - name: 'First Buy Retry Failure', - feature: Feature.FanClubs, - additionalInfo: { - errorMetadata, - formValues: sanitizeFormValuesForLogging(formValues) - } - }) + ) + ) } } else { trackCoinCreationStarted(connectedWalletAddress, formValues) @@ -632,29 +600,17 @@ export const LaunchpadPage = () => { console.warn( 'Failed to copy banner image, coin will be created without banner' ) - reportToSentry({ - error: new Error( - 'Failed to copy banner image from cover photo' - ), - name: 'Failed to Copy Banner Image', - feature: Feature.FanClubs, - level: ErrorLevel.Warning, - additionalInfo: { - bannerImageUrl: defaultBannerImageUrl - } - }) + console.error( + 'Failed to Copy Banner Image', + new Error('Failed to copy banner image from cover photo') + ) } } catch (error) { console.warn('Error copying banner image:', error) - reportToSentry({ - error: error instanceof Error ? error : new Error(String(error)), - name: 'Error Copying Banner Image', - feature: Feature.FanClubs, - level: ErrorLevel.Warning, - additionalInfo: { - bannerImageUrl: defaultBannerImageUrl - } - }) + console.error( + 'Error Copying Banner Image', + error instanceof Error ? error : new Error(String(error)) + ) } } diff --git a/packages/web/src/pages/fan-clubs-launchpad-page/pages/SetupPage.tsx b/packages/web/src/pages/fan-clubs-launchpad-page/pages/SetupPage.tsx index c6df95029cd..e9bd17958e0 100644 --- a/packages/web/src/pages/fan-clubs-launchpad-page/pages/SetupPage.tsx +++ b/packages/web/src/pages/fan-clubs-launchpad-page/pages/SetupPage.tsx @@ -1,12 +1,11 @@ import { useRef, useState } from 'react' import { launchpadMessages } from '@audius/common/messages' -import { ErrorLevel, Feature, LaunchpadFormValues } from '@audius/common/models' +import { LaunchpadFormValues } from '@audius/common/models' import { Flex, Paper, Text } from '@audius/harmony' import { useFormikContext } from 'formik' import { useFormImageUrl } from 'hooks/useFormImageUrl' -import { reportToSentry } from 'store/errors/reportToSentry' import { resizeImage, ALLOWED_IMAGE_FILE_TYPES @@ -110,12 +109,10 @@ export const SetupPage = ({ onContinue, onBack }: SetupPageProps) => { setFieldValue('coinImage', processedFile) // Hook will automatically create blob URL from processed file } catch (error) { - reportToSentry({ - error: error instanceof Error ? error : new Error(error as string), - name: 'Launchpad Image Upload Processing Error', - feature: Feature.FanClubs, - level: ErrorLevel.Warning // not worth alerting on here - }) + console.error( + 'Launchpad Image Upload Processing Error', + error instanceof Error ? error : new Error(error as string) + ) setImageError(messages.errors.processingError) } finally { setIsProcessingImage(false) diff --git a/packages/web/src/pages/fan-clubs-launchpad-page/validation.ts b/packages/web/src/pages/fan-clubs-launchpad-page/validation.ts index 6e765bd5ba0..294d5613a5d 100644 --- a/packages/web/src/pages/fan-clubs-launchpad-page/validation.ts +++ b/packages/web/src/pages/fan-clubs-launchpad-page/validation.ts @@ -7,7 +7,7 @@ import { useQueryContext, useWalletAudioBalance } from '@audius/common/api' -import { Chain, ErrorLevel, Feature } from '@audius/common/models' +import { Chain } from '@audius/common/models' import { MAX_HANDLE_LENGTH } from '@audius/common/services' import { AUDIO } from '@audius/fixed-decimal' import { useAppKitAccount as useExternalWalletAccount } from '@reown/appkit/react' @@ -16,8 +16,6 @@ import { z } from 'zod' import { toFormikValidationSchema } from 'zod-formik-adapter' import { useLaunchpadConfig } from 'hooks/useLaunchpadConfig' -import { reportToSentry } from 'store/errors/reportToSentry' - export const FIELDS = { coinName: 'coinName', coinSymbol: 'coinSymbol', @@ -119,16 +117,10 @@ export const setupFormSchema = ({ } } catch (error: any) { // This should rarely happen, and likely not a fatal error - reportToSentry({ - error: - error instanceof Error ? error : new Error(error as string), - name: 'Launchpad Ticker Validation Error', - feature: Feature.FanClubs, - level: ErrorLevel.Warning, - additionalInfo: { - ticker - } - }) + console.error( + 'Launchpad Ticker Validation Error', + error instanceof Error ? error : new Error(error as string) + ) // For other errors, show unknown error context.addIssue({ code: z.ZodIssueCode.custom, diff --git a/packages/web/src/pages/host-remix-contest-page/useUploadContestCover.ts b/packages/web/src/pages/host-remix-contest-page/useUploadContestCover.ts index 49a4605a901..29cec4a9b20 100644 --- a/packages/web/src/pages/host-remix-contest-page/useUploadContestCover.ts +++ b/packages/web/src/pages/host-remix-contest-page/useUploadContestCover.ts @@ -9,7 +9,7 @@ import { useQueryContext } from '@audius/common/api' * content-node URL the form can persist in `eventData.coverPhotoUrl`. */ export const useUploadContestCover = () => { - const { audiusSdk, reportToSentry } = useQueryContext() + const { audiusSdk } = useQueryContext() const [isUploading, setIsUploading] = useState(false) const upload = useCallback( @@ -45,17 +45,13 @@ export const useUploadContestCover = () => { return `${contentNodeEndpoint}/content/${cid}` } catch (error) { - reportToSentry({ - error: error as Error, - name: 'HostRemixContest', - additionalInfo: { where: 'useUploadContestCover' } - }) + console.error('HostRemixContest', error as Error) return null } finally { setIsUploading(false) } }, - [audiusSdk, reportToSentry] + [audiusSdk] ) return { upload, isUploading } diff --git a/packages/web/src/pages/oauth-login-page/OAuthLoginPage.tsx b/packages/web/src/pages/oauth-login-page/OAuthLoginPage.tsx index 5b40465dbe4..12fb69f98ff 100644 --- a/packages/web/src/pages/oauth-login-page/OAuthLoginPage.tsx +++ b/packages/web/src/pages/oauth-login-page/OAuthLoginPage.tsx @@ -8,7 +8,7 @@ import { useCurrentAccountUser } from '@audius/common/api' import { useAccountSwitcher } from '@audius/common/hooks' -import { Name, ErrorLevel, UserMetadata } from '@audius/common/models' +import { Name, UserMetadata } from '@audius/common/models' import { SignInResponse } from '@audius/common/services' import { signOutActions } from '@audius/common/store' import { @@ -34,7 +34,6 @@ import { AccountListContent } from 'components/nav/desktop/AccountSwitcher/Accou import { ProfileInfo } from 'components/profile-info/ProfileInfo' import { audiusSdk, authService } from 'services/audius-sdk' import { fingerprintClient } from 'services/fingerprint' -import { reportToSentry } from 'store/errors/reportToSentry' import styles from './OAuthLoginPage.module.css' import { ApproveTransactionScreen } from './components/ApproveTransactionScreen' @@ -115,7 +114,7 @@ export const OAuthLoginPage = () => { }) ) if (error && !isUserError) { - reportToSentry({ level: ErrorLevel.Error, error }) + console.error(error) } } diff --git a/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx b/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx index fecc2b01f29..0a28a0bc26b 100644 --- a/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx +++ b/packages/web/src/pages/oauth-login-page/OAuthSignUpPage.tsx @@ -1,14 +1,13 @@ import { useRef, useState } from 'react' import { accountFromSDK } from '@audius/common/adapters' -import { Name, ErrorLevel } from '@audius/common/models' +import { Name } from '@audius/common/models' import { Flex, Text } from '@audius/harmony' import { Routes, Route, Navigate, useLocation, useNavigate } from 'react-router' import { make, useRecord } from 'common/store/analytics/actions' import LoadingSpinner from 'components/loading-spinner/LoadingSpinner' import { audiusSdk, authService } from 'services/audius-sdk' -import { reportToSentry } from 'store/errors/reportToSentry' import { ContentWrapper } from './components/ContentWrapper' import { useOAuthSetup } from './hooks' @@ -94,7 +93,7 @@ export const OAuthSignUpPage = () => { }) ) if (error && !isUserError) { - reportToSentry({ level: ErrorLevel.Error, error }) + console.error(error) } }, onPendingTransactionApproval: () => {}, @@ -193,7 +192,7 @@ export const OAuthSignUpPage = () => { }) ) if (err instanceof Error) { - reportToSentry({ level: ErrorLevel.Error, error: err }) + console.error(err) } } } diff --git a/packages/web/src/pages/oauth-login-page/hooks.ts b/packages/web/src/pages/oauth-login-page/hooks.ts index ab088560e3e..68dc50855d6 100644 --- a/packages/web/src/pages/oauth-login-page/hooks.ts +++ b/packages/web/src/pages/oauth-login-page/hooks.ts @@ -1,12 +1,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react' import { useAccountStatus, useCurrentUserId } from '@audius/common/api' -import { - Name, - ErrorLevel, - statusIsNotFinalized, - UserMetadata -} from '@audius/common/models' +import { Name, statusIsNotFinalized, UserMetadata } from '@audius/common/models' import { Id } from '@audius/sdk' import * as queryString from 'query-string' import { useDispatch } from 'react-redux' @@ -16,7 +11,6 @@ import { make, useRecord } from 'common/store/analytics/actions' import { audiusSdk } from 'services/audius-sdk' import { identityService } from 'services/audius-sdk/identity' import * as errorActions from 'store/errors/actions' -import { reportToSentry } from 'store/errors/reportToSentry' import { messages } from './messages' import { Display } from './types' @@ -456,7 +450,7 @@ export const useOAuthSetup = ({ }) } catch (e) { if (e instanceof Error) { - reportToSentry({ level: ErrorLevel.Error, error: e }) + console.error(e) } dispatch( errorActions.handleError({ diff --git a/packages/web/src/pages/upload-page/pages/SelectPage.tsx b/packages/web/src/pages/upload-page/pages/SelectPage.tsx index 1aa06ca92e7..0249f00564e 100644 --- a/packages/web/src/pages/upload-page/pages/SelectPage.tsx +++ b/packages/web/src/pages/upload-page/pages/SelectPage.tsx @@ -1,6 +1,5 @@ import { useCallback, useLayoutEffect, useState } from 'react' -import { ErrorLevel, Feature } from '@audius/common/models' import { newCollectionMetadata } from '@audius/common/schemas' import { TrackMetadataForUpload, @@ -13,7 +12,6 @@ import cn from 'classnames' import { AudioQuality } from 'components/upload/AudioQuality' import { Dropzone } from 'components/upload/Dropzone' import { InvalidFileType } from 'components/upload/InvalidFileType' -import { reportToSentry } from 'store/errors/reportToSentry' import { TracksPreview } from '../components/TracksPreview' import { processFiles } from '../store/utils/processFiles' @@ -68,15 +66,10 @@ const SelectPage = (props: SelectPageProps) => { }) const processedFiles = processFiles(selectedFiles, (name, reason) => { - reportToSentry({ - name: 'UploadProcessFiles', - error: new Error(`${reason} error for file ${name}`), - feature: Feature.Upload, - level: ErrorLevel.Warning, - additionalInfo: { - selectedFiles - } - }) + console.error( + 'UploadProcessFiles', + new Error(`${reason} error for file ${name}`) + ) return setUploadTrackError({ reason }) }) const processedTracks = (await Promise.all(processedFiles)).filter( diff --git a/packages/web/src/services/audius-backend/audius-backend-instance.ts b/packages/web/src/services/audius-backend/audius-backend-instance.ts index dcca5421c48..8ca3bba3bbf 100644 --- a/packages/web/src/services/audius-backend/audius-backend-instance.ts +++ b/packages/web/src/services/audius-backend/audius-backend-instance.ts @@ -3,7 +3,6 @@ import { audiusBackend } from '@audius/common/services' import { track } from 'services/analytics' import { getFeatureEnabled } from 'services/remote-config/featureFlagHelpers' import { remoteConfigInstance } from 'services/remote-config/remote-config-instance' -import { reportToSentry } from 'store/errors/reportToSentry' import { isElectron } from 'utils/clientUtil' import { env } from '../env' @@ -26,7 +25,7 @@ export const audiusBackendInstance = audiusBackend({ nativeMobile: false, recaptchaSiteKey: env.RECAPTCHA_SITE_KEY, recordAnalytics: track, - reportError: reportToSentry, + reportError: ({ error }) => console.error(error), registryAddress: env.REGISTRY_ADDRESS, entityManagerAddress: env.ENTITY_MANAGER_ADDRESS, remoteConfigInstance, diff --git a/packages/web/src/services/env/env.dev.ts b/packages/web/src/services/env/env.dev.ts index 75883f61014..75d0c6493b8 100644 --- a/packages/web/src/services/env/env.dev.ts +++ b/packages/web/src/services/env/env.dev.ts @@ -63,7 +63,6 @@ export const env: Env = { REWARDS_MANAGER_TOKEN_PDA: 'FRk4j95RG2kSk3BHXBPVgKszFc2rLQ8K6RS83k3dmzvQ', SAFARI_WEB_PUSH_ID: 'web.co.audius', SCHEME: 'audius', - SENTRY_DSN: 'https://4b15a7a2f2e2459997408b39a0c4942c@s.audius.co/1851611', SOL_BRIDGE_ADDRESS: null, SOL_TOKEN_BRIDGE_ADDRESS: null, SOLANA_CLUSTER_ENDPOINT: 'http://audius-solana-test-validator-1', diff --git a/packages/web/src/services/env/env.prod.ts b/packages/web/src/services/env/env.prod.ts index 5223f0f1b0e..487232a541e 100644 --- a/packages/web/src/services/env/env.prod.ts +++ b/packages/web/src/services/env/env.prod.ts @@ -62,7 +62,6 @@ export const env: Env = { REWARDS_MANAGER_TOKEN_PDA: '3V9opXNpHmPPymKeq7CYD8wWMH8wzFXmqEkNdzfsZhYq', SAFARI_WEB_PUSH_ID: 'web.co.audius', SCHEME: 'audius', - SENTRY_DSN: 'https://e26d2b01488f4b538ea235de6466c40a@s.audius.co/1457231', SOL_BRIDGE_ADDRESS: 'worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth', SOL_TOKEN_BRIDGE_ADDRESS: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb', SOLANA_CLUSTER_ENDPOINT: diff --git a/packages/web/src/services/query-client.ts b/packages/web/src/services/query-client.ts index 1af2ab466f8..d7af541c85e 100644 --- a/packages/web/src/services/query-client.ts +++ b/packages/web/src/services/query-client.ts @@ -1,15 +1,13 @@ import { defaultRetryConfig, queryErrorHandler } from '@audius/common/api' import { QueryCache, QueryClient } from '@tanstack/react-query' -import { reportToSentry } from 'store/errors/reportToSentry' - import { env } from './env' export const queryClient = new QueryClient({ // In order to have a default error catcher, we need to use a custom query cache // ref: https://tkdodo.eu/blog/react-query-error-handling queryCache: new QueryCache({ onError(error, query) { - queryErrorHandler(error, query, reportToSentry) + queryErrorHandler(error, query) } }), defaultOptions: { diff --git a/packages/web/src/services/remote-config/remote-config-instance.ts b/packages/web/src/services/remote-config/remote-config-instance.ts index 86b693e927b..37f2bfe1226 100644 --- a/packages/web/src/services/remote-config/remote-config-instance.ts +++ b/packages/web/src/services/remote-config/remote-config-instance.ts @@ -1,10 +1,8 @@ -import { ErrorLevel } from '@audius/common/models' import { remoteConfig } from '@audius/common/services' import optimizely, { Config } from '@optimizely/optimizely-sdk' import { isEmpty } from 'lodash' import { env } from 'services/env' -import { reportToSentry } from 'store/errors/reportToSentry' import { isElectron } from 'utils/clientUtil' import packageInfo from '../../../package.json' @@ -35,20 +33,14 @@ export const remoteConfigInstance = remoteConfig({ const datafile = window.optimizelyDatafile if (isEmpty(datafile)) { - reportToSentry({ - level: ErrorLevel.Error, - error: new Error('Optimizely failed to load') - }) + console.error(new Error('Optimizely failed to load')) } return optimizely.createInstance({ datafile, errorHandler: { handleError: (error) => { - reportToSentry({ - level: ErrorLevel.Error, - error - }) + console.error(error) } } }) diff --git a/packages/web/src/services/sentry.ts b/packages/web/src/services/sentry.ts deleted file mode 100644 index 3f2a61b465f..00000000000 --- a/packages/web/src/services/sentry.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { DoubleKeys } from '@audius/common/services' - -import packageJson from '../../package.json' - -import { env } from './env' -import { remoteConfigInstance } from './remote-config/remote-config-instance' -const { version: appVersion } = packageJson - -const analyticsBlacklist = [ - 'google-analytics', - 'stats.g', - 'fullstory', - 'amplitude', - 'mixpanel', - 'mouseflow' -] - -const MAX_BREADCRUMBS = 300 - -// Noisy, non-actionable error patterns we don't want clogging Sentry. -// Each entry is matched against the event's error message and exception value. -const NOISY_ERROR_PATTERNS: RegExp[] = [ - // Code-splitting / dynamic import failures. Almost always a stale deploy or - // flaky network — not a real bug we can fix in code. - /ChunkLoadError/i, - /Loading chunk [\w-]+ failed/i, - /Failed to fetch dynamically imported module/i, - /Importing a module script failed/i, - // ResizeObserver loop warnings. Browsers fire these spuriously and they - // don't represent real errors — ignored by all major frameworks. - /ResizeObserver loop limit exceeded/i, - /ResizeObserver loop completed with undelivered notifications/i, - // Aborted fetches. Caused by user navigation or component unmount, not bugs. - /AbortError/i, - /The user aborted a request/i, - // Generic network failures — user offline, captive portal, ad blocker, etc. - /Failed to fetch/i, - /NetworkError/i, - /Load failed/i, - /The network connection was lost/i, - // Browser permission denials (mic, camera, clipboard, notifications) — - // expected user choices, not bugs. - /NotAllowedError/i -] - -let sentryInitialized = false -let sentryInitPromise: Promise | null = null - -/** - * Lazy-load and initialize Sentry SDK - */ -export const initializeSentry = async () => { - // Return existing promise if initialization is already in progress - if (sentryInitPromise) { - return sentryInitPromise - } - - // Return immediately if already initialized - if (sentryInitialized) { - return - } - - sentryInitPromise = (async () => { - try { - await remoteConfigInstance.waitForRemoteConfig() - - // Lazy load Sentry SDK - const Sentry = await import('@sentry/browser') - - Sentry.init({ - dsn: env.SENTRY_DSN, - transport: Sentry.makeBrowserOfflineTransport( - Sentry.makeFetchTransport - ), - ignoreErrors: - process.env.VITE_SENTRY_DISABLED === 'true' ? [/.*/] : undefined, - - // Use our semantic release version for release tracking - release: appVersion, - - integrations: [ - // Pull extra fields off error objects - Sentry.extraErrorDataIntegration(), - // Capture a session recording - Sentry.replayIntegration({}) - ], - - normalizeDepth: 5, - maxBreadcrumbs: MAX_BREADCRUMBS, - beforeSend: (event, hint) => { - const exception = event.exception?.values?.[0] - const message = - (typeof hint?.originalException === 'object' && - hint?.originalException !== null && - 'message' in hint.originalException - ? String( - (hint.originalException as { message?: unknown }).message ?? - '' - ) - : '') || - exception?.value || - event.message || - '' - const stack = exception?.stacktrace?.frames?.length ?? 0 - - // Drop known-noisy error patterns (chunk load, ResizeObserver, - // network/abort, permission denials). See NOISY_ERROR_PATTERNS above - // for the full rationale. - if (NOISY_ERROR_PATTERNS.some((pattern) => pattern.test(message))) { - if (env.ENVIRONMENT !== 'production') { - console.warn('[sentry] dropped noisy error:', message) - } - return null - } - - // Drop unhandled rejections / exceptions that have no stack and - // either an empty message or a message too short to be actionable - // (e.g. "true", "null", "Error"). These are almost always thrown - // non-Error values from third-party scripts. - if (stack === 0 && message.trim().length < 10) { - if (env.ENVIRONMENT !== 'production') { - console.warn( - '[sentry] dropped low-signal error (no stack, short message):', - JSON.stringify(message) - ) - } - return null - } - - return event - }, - beforeBreadcrumb: (breadCrumb, hint) => { - // filter out info and debug logs - if ( - (breadCrumb.level === 'info' || breadCrumb.level === 'debug') && - breadCrumb.category === 'console' - ) { - return null - } - // filter out analytics events - if (hint && hint.xhr) { - const url = hint.xhr.__sentry_xhr_v3__.url - const isAnalyticsRequest = analyticsBlacklist.some( - (term) => url.search(term) !== -1 - ) - if (isAnalyticsRequest) { - return null - } - } - return breadCrumb - }, - // This is the sample rate for healthy sessions without errors - set to 0 since we only care about errors - replaysSessionSampleRate: 0, - // This is a sample rate specific to when errors occur. We want to see 100% of them - replaysOnErrorSampleRate: Number( - remoteConfigInstance.getRemoteVar( - DoubleKeys.SENTRY_REPLAY_ERROR_SAMPLE_RATE - ) ?? 0 - ) - }) - - Sentry.setTag('commit_sha', process.env.VITE_CURRENT_GIT_SHA) - Sentry.setTag('platform', 'web') - - sentryInitialized = true - } catch (err) { - console.error('Failed to initialize Sentry:', err) - sentryInitPromise = null - throw err - } - })() - - return sentryInitPromise -} - -/** - * Get Sentry SDK instance, initializing if necessary - */ -export const getSentry = async () => { - await initializeSentry() - return import('@sentry/browser') -} diff --git a/packages/web/src/ssr/worker.js b/packages/web/src/ssr/worker.js index 320c1ac3d6d..6c38eb810a1 100644 --- a/packages/web/src/ssr/worker.js +++ b/packages/web/src/ssr/worker.js @@ -9,7 +9,6 @@ import { getAssetFromKV } from '@cloudflare/kv-asset-handler' // eslint-disable-next-line import/no-unresolved import manifestJSON from '__STATIC_CONTENT_MANIFEST' -import { Toucan } from 'toucan-js' import { renderPage } from 'vike/server' try { // eslint-disable-next-line import/no-unresolved @@ -25,20 +24,10 @@ const BROWSER_CACHE_TTL_SECONDS = 60 * 60 * 24 export default { async fetch(request, env, ctx) { - const sentry = env.SENTRY_DSN - ? new Toucan({ - dsn: env.SENTRY_DSN, - context: ctx, - request - }) - : null - try { return await handleRequest(request, env, ctx) } catch (e) { - if (sentry) { - sentry.captureException(e) - } + console.error('SSR worker error:', e) if (DEBUG) { return new Response(e.message || e.toString(), { status: 500 }) } diff --git a/packages/web/src/store/application/ui/stemsUpload/sagas.ts b/packages/web/src/store/application/ui/stemsUpload/sagas.ts index 9cdac55170d..0384a7ccebe 100644 --- a/packages/web/src/store/application/ui/stemsUpload/sagas.ts +++ b/packages/web/src/store/application/ui/stemsUpload/sagas.ts @@ -25,7 +25,6 @@ function* watchUploadStems() { const audiusSdk = yield* getContext('audiusSdk') const dispatch = yield* getContext('dispatch') - const reportToSentry = yield* getContext('reportToSentry') const analytics = yield* getContext('analytics') const userId = yield* call(queryCurrentUserId) if (!userId) { @@ -47,7 +46,6 @@ function* watchUploadStems() { audiusSdk, dispatch, userId, - reportToSentry, analytics }, { diff --git a/packages/web/src/store/configureStore.ts b/packages/web/src/store/configureStore.ts index 542ad3cf482..eddba311a56 100644 --- a/packages/web/src/store/configureStore.ts +++ b/packages/web/src/store/configureStore.ts @@ -1,7 +1,7 @@ -import { Name, ErrorLevel } from '@audius/common/models' +import { Name } from '@audius/common/models' import { chatMiddleware } from '@audius/common/store' import { composeWithDevToolsLogOnlyInProduction } from '@redux-devtools/extension' -import { createStore, applyMiddleware, Action, Store } from 'redux' +import { createStore, applyMiddleware, Store } from 'redux' import { persistStore } from 'redux-persist' import createSagaMiddleware from 'redux-saga' import thunk from 'redux-thunk' @@ -10,7 +10,6 @@ import { PartialDeep } from 'type-fest' import { audiusSdk } from 'services/audius-sdk' import { queryClient } from 'services/query-client' import * as errorActions from 'store/errors/actions' -import { reportToSentry } from 'store/errors/reportToSentry' import createRootReducer from 'store/reducers' import rootSaga from 'store/sagas' @@ -40,130 +39,6 @@ declare global { type StoreType = ReturnType['store'] type RootState = ReturnType -// Can't send up the entire Redux state b/c it's too fat -// for Sentry to handle, and there is sensitive data -const statePruner = (state: AppState) => { - const currentProfileHandle = state.pages.profile.currentUser ?? '' - const currentProfile = state.pages.profile.entries[currentProfileHandle] ?? {} - - return { - account: { - status: state.account.status, - userId: state.account.userId, - reason: state.account.reason - }, - pages: { - profile: { - handle: currentProfile.handle, - status: currentProfile.status, - updateError: currentProfile.updateError, - updateSuccess: currentProfile.updateSuccess, - updating: currentProfile.updating, - userId: currentProfile.userId - } - }, - // Router state removed - using react-router-dom directly now - signOn: { - accountReady: state.signOn.accountReady, - email: state.signOn.email, - handle: state.signOn.handle, - status: state.signOn.status, - useExternalWallet: state.signOn.usingExternalWallet, - verified: state.signOn.verified - }, - upload: { - completionId: state.upload.completionId, - failedTrackIndices: state.upload.failedTrackIndices, - metadata: state.upload.metadata, - success: state.upload.success, - uploading: state.upload.uploading, - uploadProgress: state.upload.uploadProgress, - uploadType: state.upload.uploadType - } - } -} - -// We're not logging any action bodies to prevent us from accidentally -// logging sensitive information in the future if additional actions are added. -// If we discover we want specific action bodies in the future for Sentry -// debuggability, those should be whitelisted here. -const actionSanitizer = (action: Action) => ({ type: action.type }) - -// Lazy-load Sentry middleware wrapper -// This creates a middleware that lazy-loads the actual Sentry SDK and middleware -type SentryMiddlewareFactory = ( - store: any -) => (next: any) => (action: Action) => any -let sentryMiddlewareFactory: SentryMiddlewareFactory | null = null -let sentryMiddlewarePromise: Promise | null = - null - -const createLazySentryMiddleware = () => { - return (store: any) => { - let sentryNext: ((action: Action) => any) | null = null - - return (next: any) => (action: Action) => { - // Lazy load Sentry middleware on first action - if (!sentryMiddlewareFactory && !sentryMiddlewarePromise) { - sentryMiddlewarePromise = (async () => { - try { - const [Sentry, createSentryMiddleware] = await Promise.all([ - import('@sentry/browser'), - import('redux-sentry-middleware') - ]) - - const middleware = createSentryMiddleware.default( - { - configureScope: Sentry.configureScope, - addBreadcrumb: Sentry.addBreadcrumb - } as any, - { - actionTransformer: actionSanitizer, - stateTransformer: statePruner - } - ) - - sentryMiddlewareFactory = middleware - return sentryMiddlewareFactory - } catch (err) { - console.error('Failed to load Sentry middleware:', err) - sentryMiddlewarePromise = null - return null - } - })() - } - - // If middleware is already loaded, use it - if (sentryMiddlewareFactory) { - if (!sentryNext) { - sentryNext = sentryMiddlewareFactory(store)(next) - } - return sentryNext(action) - } - - // If still loading, pass through the action for now - if (sentryMiddlewarePromise) { - sentryMiddlewarePromise - .then((factory) => { - if (factory) { - sentryNext = factory(store)(next) - if (sentryNext) { - sentryNext(action) - } - } - }) - .catch(() => { - // Silently fail - just pass through - }) - } - - return next(action) - } - } -} - -const sentryMiddleware = createLazySentryMiddleware() - export const configureStore = ({ isMobile, initialStoreState, @@ -194,11 +69,6 @@ export const configureStore = ({ route: window.location.pathname } - reportToSentry({ - level: ErrorLevel.Fatal, - error, - additionalInfo - }) // Fire and forget - don't await to avoid blocking error handling amplitudeTrack(Name.ERROR_PAGE, additionalInfo).catch((err) => { console.error('Failed to track error in Amplitude:', err) @@ -219,7 +89,6 @@ export const configureStore = ({ chatMiddleware(audiusSdk, queryClient), // Don't run sagas serverside ...(typeof window !== 'undefined' ? [sagaMiddleware!] : []), - sentryMiddleware, thunk ) diff --git a/packages/web/src/store/errors/actions.ts b/packages/web/src/store/errors/actions.ts index 53859c2ff52..ff28657d81d 100644 --- a/packages/web/src/store/errors/actions.ts +++ b/packages/web/src/store/errors/actions.ts @@ -1,10 +1,3 @@ -import { - ErrorLevel, - AdditionalErrorReportInfo, - ReportToSentryArgs, - Feature -} from '@audius/common/models' - export const HANDLE_ERROR = 'ERROR/HANDLE_ERROR' export const OPEN_ERROR_PAGE = 'ERROR/OPEN_ERROR_PAGE' export const CLOSE_ERROR_PAGE = 'ERROR/CLOSE_ERROR_PAGE' @@ -24,9 +17,7 @@ export type HandleErrorAction = { // shouldRedirect is true unless a redirectRoute is passed in shouldToast?: boolean - additionalInfo?: AdditionalErrorReportInfo - level?: ErrorLevel - feature?: Feature + additionalInfo?: Record uiErrorCode: UiErrorCode } @@ -43,8 +34,10 @@ export type HandleErrorArgs = { shouldReport?: boolean shouldToast?: boolean message: string + name?: string + additionalInfo?: Record uiErrorCode?: UiErrorCode -} & Omit +} export const handleError = ({ name, @@ -53,7 +46,6 @@ export const handleError = ({ shouldRedirect, shouldToast, additionalInfo = {}, - level, uiErrorCode = UiErrorCode.UNKNOWN }: HandleErrorArgs): HandleErrorAction => ({ type: HANDLE_ERROR, @@ -63,7 +55,6 @@ export const handleError = ({ shouldReport, shouldToast, additionalInfo, - level, uiErrorCode }) diff --git a/packages/web/src/store/errors/reportToSentry.ts b/packages/web/src/store/errors/reportToSentry.ts deleted file mode 100644 index 8a932f005a7..00000000000 --- a/packages/web/src/store/errors/reportToSentry.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { ErrorLevel, ReportToSentryArgs } from '@audius/common/models' -import { getErrorMessage, isResponseError } from '@audius/common/utils' -import type { SeverityLevel } from '@sentry/types' - -const Levels: { [level in ErrorLevel]: SeverityLevel } = { - Warning: 'warning', - Fatal: 'fatal', - Debug: 'debug', - Error: 'error', - Info: 'info', - Log: 'log' -} - -type ConsoleLoggingMethod = keyof Pick< - Console, - 'log' | 'warn' | 'error' | 'info' | 'debug' -> - -const jsLoggerMapping: { [level in ErrorLevel]: ConsoleLoggingMethod } = { - Warning: 'warn', - Fatal: 'error', - Debug: 'debug', - Error: 'error', - Info: 'info', - Log: 'log' -} - -/** - * Helper fn that reports to sentry while creating a localized scope to contain additional data - * Also logs to console with the appropriate level (console.log, console.warn, console.error, etc) - */ -export const reportToSentry = async ({ - level = ErrorLevel.Error, - additionalInfo, - error, - name, - tags, - feature -}: ReportToSentryArgs) => { - try { - // Lazy load Sentry SDK - const Sentry = await import('@sentry/browser') - const { withScope, captureException } = Sentry - - withScope(async (scope) => { - if (level) { - const sentryLevel = Levels[level] - scope.setLevel(sentryLevel) - } - if (isResponseError(error)) { - const responseBody = - (await error.response.json().catch()) ?? - (await error.response.text().catch()) - additionalInfo = { - ...additionalInfo, - response: error.response, - requestId: error.response.headers.get('X-Request-ID'), - responseBody - } - } - if (additionalInfo) { - scope.setContext('additionalInfo', additionalInfo) - } - if (tags || feature) { - scope.setTags({ ...tags, feature }) - } - if (name) { - error.name = `${name}: ${error.name}` - } - // Call JS console method using the specified level - const consoleMethod = - jsLoggerMapping[level || ErrorLevel.Log] || jsLoggerMapping.Log - // eslint-disable-next-line no-console - console[consoleMethod](error, 'More info in console.debug') - if (additionalInfo || tags) { - console.debug('Additional error info:', { additionalInfo, tags, level }) - } - captureException(error) - }) - } catch (error) { - console.error(`Got error trying to log error: ${getErrorMessage(error)}`) - } -} diff --git a/packages/web/src/store/errors/sagas.ts b/packages/web/src/store/errors/sagas.ts index 313097350d1..c2153f905d2 100644 --- a/packages/web/src/store/errors/sagas.ts +++ b/packages/web/src/store/errors/sagas.ts @@ -5,19 +5,12 @@ import { takeEvery, put } from 'redux-saga/effects' import { make } from 'common/store/analytics/actions' import * as errorActions from './actions' -import { reportToSentry } from './reportToSentry' const { toast } = toastActions function* handleError(action: errorActions.HandleErrorAction) { console.debug(`Handling error: ${action.message}`) if (action.shouldReport) { - reportToSentry({ - level: action.level, - additionalInfo: action.additionalInfo, - error: new Error(action.message), - name: action.name, - feature: action.feature - }) + console.error(action.name ?? 'Error', action.message, action.additionalInfo) yield put( make(Name.APP_ERROR, { errorMessage: action?.message ?? 'Unknown Error' diff --git a/packages/web/src/store/reload/sagas.ts b/packages/web/src/store/reload/sagas.ts index cb7227d231c..f5997416a18 100644 --- a/packages/web/src/store/reload/sagas.ts +++ b/packages/web/src/store/reload/sagas.ts @@ -3,7 +3,6 @@ import { createAction } from '@reduxjs/toolkit' import { call, fork, select, takeEvery } from 'typed-redux-saga' import { env } from 'services/env' -import { reportToSentry } from 'store/errors/reportToSentry' import { foregroundPollingDaemon, visibilityPollingDaemon @@ -51,11 +50,9 @@ function* reloadIfNecessary() { }) } } catch (e) { - console.error('[reload] Failed to check git SHA.', e) - yield* call(reportToSentry, { - name: 'Failed to check git SHA', - error: e as Error, - additionalInfo: { fetchedSha, localSha } + console.error('[reload] Failed to check git SHA.', e, { + fetchedSha, + localSha }) } } diff --git a/packages/web/src/store/storeContext.ts b/packages/web/src/store/storeContext.ts index 5b8a7b443b0..720ff5c082b 100644 --- a/packages/web/src/store/storeContext.ts +++ b/packages/web/src/store/storeContext.ts @@ -23,7 +23,6 @@ import { isElectron } from 'utils/clientUtil' import { generatePlaylistArtwork } from 'utils/imageProcessingUtil' import { getShare } from 'utils/share' -import { reportToSentry } from './errors/reportToSentry' import { getLineupSelectorForRoute } from './lineup/lineupForRoute' export const buildStoreContext = ({ @@ -60,21 +59,6 @@ export const buildStoreContext = ({ getLineupSelectorForRoute, audioPlayer: audioPlayer!, nftClient: null, - sentry: { - setTag: async (...args) => { - const Sentry = await import('@sentry/browser') - return Sentry.setTag(...args) - }, - getCurrentScope: () => ({ - setUser: (user: any) => { - // Lazy load Sentry and set user asynchronously - import('@sentry/browser').then((Sentry) => { - Sentry.getCurrentScope().setUser(user) - }) - } - }) - }, - reportToSentry, trackDownload, instagramAppId: env.INSTAGRAM_APP_ID, instagramRedirectUrl: env.INSTAGRAM_REDIRECT_URL, diff --git a/packages/web/src/utils/errorSagas.ts b/packages/web/src/utils/errorSagas.ts index 252141fb92d..82fe032eae5 100644 --- a/packages/web/src/utils/errorSagas.ts +++ b/packages/web/src/utils/errorSagas.ts @@ -1,4 +1,3 @@ -import { AdditionalErrorReportInfo, Feature } from '@audius/common/models' import { takeEvery, put } from 'redux-saga/effects' import * as errorActions from 'store/errors/actions' @@ -11,15 +10,13 @@ export const createErrorSagas = ({ getShouldRedirect, getShouldReport, getType = (actionType: string) => actionType, // optionally modify the error type sent to our error reporting service - getAdditionalInfo = (action: ActionType) => ({}), // optionally add additional info to the error report - feature + getAdditionalInfo = (action: ActionType) => ({}) }: { errorTypes: string[] getShouldRedirect: (action: ActionType) => boolean getShouldReport: (action: ActionType) => boolean getType?: (actionType: string) => string - getAdditionalInfo?: (action: ActionType) => AdditionalErrorReportInfo - feature?: Feature + getAdditionalInfo?: (action: ActionType) => Record }) => { function* handleError(action: ActionType) { console.info(`Handling error: ${JSON.stringify(action)}`) @@ -32,8 +29,7 @@ export const createErrorSagas = ({ message: actionType, shouldRedirect, shouldReport, - additionalInfo, - feature + additionalInfo }) ) }