π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Further prune down Sentry
Manav Rathic34654e9950a
diff --git a/apps/auth/src/pages/_app.tsx b/apps/auth/src/pages/_app.tsxindex 5e79d1d1e1..eca7e58366 100644--- a/apps/auth/src/pages/_app.tsx+++ b/apps/auth/src/pages/_app.tsx@@ -90,7 +90,7 @@ export default function App(props: EnteAppProps) {const main = async () => {addLogLine(`userID: ${(getData(LS_KEYS.USER) as User)?.id}`);addLogLine(`sentryID: ${await getSentryUserID()}`);- addLogLine(`sentry release ID: ${process.env.SENTRY_RELEASE}`);+ addLogLine(`sentry release: ${process.env.SENTRY_RELEASE}`);};main();}, []);diff --git a/apps/photos/.env.development b/apps/photos/.env.developmentindex 670de82528..9e7aa7b5af 100644--- a/apps/photos/.env.development+++ b/apps/photos/.env.development@@ -57,13 +57,6 @@## NEXT_PUBLIC_ENTE_FAMILY_PORTAL_ENDPOINT = http://localhost:3003-# Set this to true to disable reporting of crashes to Sentry.-#-# Crash reporting is disabled if the user has opted out. This provides another-# way to disable crash reporting, say for local test branches.-#-# NEXT_PUBLIC_DISABLE_SENTRY=true-# Set this to "true" to disable the upload of files of Cloudflare Workers.## These workers were introduced as a way of make the file uploads faster@@ -77,4 +70,5 @@# The path of the JSON file which contains the expected results of our# integration tests. See `upload.test.ts` for more details.+## NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON_PATH = /path/to/dataset/expected.jsondiff --git a/apps/photos/src/pages/_app.tsx b/apps/photos/src/pages/_app.tsxindex f60e541f82..9fc31ab422 100644--- a/apps/photos/src/pages/_app.tsx+++ b/apps/photos/src/pages/_app.tsx@@ -171,7 +171,7 @@ export default function App(props: EnteAppProps) {const main = async () => {addLogLine(`userID: ${(getData(LS_KEYS.USER) as User)?.id}`);addLogLine(`sentryID: ${await getSentryUserID()}`);- addLogLine(`sentry release ID: ${process.env.SENTRY_RELEASE}`);+ addLogLine(`sentry release: ${process.env.SENTRY_RELEASE}`);};main();}, []);diff --git a/packages/shared/apps/env.ts b/packages/shared/apps/env.tsdeleted file mode 100644index 988bedc454..0000000000--- a/packages/shared/apps/env.ts+++ /dev/null@@ -1,5 +0,0 @@-export const isDisableSentryFlagSet = () => {- return process.env.NEXT_PUBLIC_DISABLE_SENTRY === 'true';-};--export const getSentryRelease = () => process.env.SENTRY_RELEASE;diff --git a/packages/shared/next/env.js b/packages/shared/next/env.jsdeleted file mode 100644index 47a54053ad..0000000000--- a/packages/shared/next/env.js+++ /dev/null@@ -1,17 +0,0 @@-const ENV_DEVELOPMENT = 'development';-const ENV_PRODUCTION = 'production';-const ENV_TEST = 'test';--module.exports = {- ENV_DEVELOPMENT,- ENV_PRODUCTION,- ENV_TEST,-};--module.exports.getAppEnv = () => {- return process.env.NEXT_PUBLIC_APP_ENV ?? ENV_PRODUCTION;-};--module.exports.isDisableSentryFlagSet = () => {- return process.env.NEXT_PUBLIC_DISABLE_SENTRY === 'true';-};diff --git a/packages/shared/next/next.config.base.js b/packages/shared/next/next.config.base.jsindex b7537752c3..a54a406b72 100644--- a/packages/shared/next/next.config.base.js+++ b/packages/shared/next/next.config.base.js@@ -1,11 +1,12 @@const { withSentryConfig } = require('@sentry/nextjs');const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');-const { getGitSha, getIsSentryEnabled } = require('./utils/sentry');+const cp = require('child_process');-const GIT_SHA = getGitSha();--const IS_SENTRY_ENABLED = getIsSentryEnabled();+const gitSHA = cp.execSync('git rev-parse --short HEAD', {+ cwd: __dirname,+ encoding: 'utf8',+});module.exports = (phase) =>withSentryConfig(@@ -43,7 +44,8 @@ module.exports = (phase) =>],env: {// Sentry reads this env var to set the "release" value.- SENTRY_RELEASE: GIT_SHA,+ // TODO(MR): We also set this below, are both places required?+ SENTRY_RELEASE: gitSHA,},// https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j@@ -55,7 +57,7 @@ module.exports = (phase) =>},},{- dryRun: phase === PHASE_DEVELOPMENT_SERVER || !IS_SENTRY_ENABLED,- release: GIT_SHA,+ dryRun: phase === PHASE_DEVELOPMENT_SERVER,+ release: gitSHA,});diff --git a/packages/shared/next/utils/sentry.js b/packages/shared/next/utils/sentry.jsdeleted file mode 100644index c08a8042c8..0000000000--- a/packages/shared/next/utils/sentry.js+++ /dev/null@@ -1,18 +0,0 @@-const {- getAppEnv,- ENV_DEVELOPMENT,- isDisableSentryFlagSet,-} = require('../env.js');-const cp = require('child_process');--module.exports.getIsSentryEnabled = () => {- const isAppENVDevelopment = getAppEnv() === ENV_DEVELOPMENT;- const isSentryDisabled = isDisableSentryFlagSet();- return !isAppENVDevelopment && !isSentryDisabled;-};--module.exports.getGitSha = () =>- cp.execSync('git rev-parse --short HEAD', {- cwd: __dirname,- encoding: 'utf8',- });diff --git a/packages/shared/sentry/utils.ts b/packages/shared/sentry/utils.tsindex c9c0ff4d6c..bd2dfcc899 100644--- a/packages/shared/sentry/utils.ts+++ b/packages/shared/sentry/utils.ts@@ -4,10 +4,8 @@ import {setLocalSentryUserID,} from '@ente/shared/storage/localStorage/helpers';import isElectron from 'is-electron';-import { isDisableSentryFlagSet } from '@ente/shared/apps/env';import { ApiError } from '../error';import { HttpStatusCode } from 'axios';-import { isDevBuild } from '../network/api';export async function getSentryUserID() {if (isElectron()) {@@ -46,8 +44,3 @@ export function isErrorUnnecessaryForSentry(error: any) {}return false;}--export const getIsSentryEnabled = () => {- const isSentryDisabled = isDisableSentryFlagSet();- return !isDevBuild() && !isSentryDisabled;-};