Resurrect SENTRY_AUTH_TOKEN
This commit is contained in:
parent
c34654e995
commit
d54ff83bba
8 changed files with 56 additions and 57 deletions
|
@ -1,3 +1,3 @@
|
|||
import { setupSentry } from '@ente/shared/sentry/config/sentry.config.base';
|
||||
import { initSentry } from '@ente/shared/sentry/config/sentry.config.base';
|
||||
|
||||
setupSentry('https://ad075e4713480307bb8bc0811547c65e@sentry.ente.io/8');
|
||||
initSentry('https://ad075e4713480307bb8bc0811547c65e@sentry.ente.io/8');
|
||||
|
|
7
apps/photos/.sentryclirc
Normal file
7
apps/photos/.sentryclirc
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This file is used by sentry-cli and the SentryWebPack plugin to upload
|
||||
# sourcemaps. In addition to the configuration specified here, Sentry expects an
|
||||
# environment variable named SENTRY_AUTH_TOKEN.
|
||||
[defaults]
|
||||
url=https://sentry.ente.io/
|
||||
org=ente
|
||||
project=photos-web
|
|
@ -1,3 +1,3 @@
|
|||
import { setupSentry } from '@ente/shared/sentry/config/sentry.config.base';
|
||||
import { initSentry } from '@ente/shared/sentry/config/sentry.config.base';
|
||||
|
||||
setupSentry('https://cbed7333f2810fbbdb692dcd76d8ca1a@sentry.ente.io/2');
|
||||
initSentry('https://cbed7333f2810fbbdb692dcd76d8ca1a@sentry.ente.io/2');
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
defaults.url=https://sentry.ente.io/
|
||||
defaults.org=ente
|
||||
defaults.project=photos-web
|
|
@ -1,6 +1,5 @@
|
|||
const { withSentryConfig } = require('@sentry/nextjs');
|
||||
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
|
||||
|
||||
const cp = require('child_process');
|
||||
|
||||
const gitSHA = cp.execSync('git rev-parse --short HEAD', {
|
||||
|
@ -8,56 +7,51 @@ const gitSHA = cp.execSync('git rev-parse --short HEAD', {
|
|||
encoding: 'utf8',
|
||||
});
|
||||
|
||||
module.exports = (phase) =>
|
||||
withSentryConfig(
|
||||
{
|
||||
sentry: {
|
||||
widenClientFileUpload: true,
|
||||
disableServerWebpackPlugin: true,
|
||||
autoInstrumentServerFunctions: false,
|
||||
},
|
||||
compiler: {
|
||||
emotion: {
|
||||
importMap: {
|
||||
'@mui/material': {
|
||||
styled: {
|
||||
canonicalImport: ['@emotion/styled', 'default'],
|
||||
styledBaseImport: ['@mui/material', 'styled'],
|
||||
},
|
||||
},
|
||||
'@mui/material/styles': {
|
||||
styled: {
|
||||
canonicalImport: ['@emotion/styled', 'default'],
|
||||
styledBaseImport: [
|
||||
'@mui/material/styles',
|
||||
'styled',
|
||||
],
|
||||
},
|
||||
},
|
||||
const nextConfig = {
|
||||
compiler: {
|
||||
emotion: {
|
||||
importMap: {
|
||||
'@mui/material': {
|
||||
styled: {
|
||||
canonicalImport: ['@emotion/styled', 'default'],
|
||||
styledBaseImport: ['@mui/material', 'styled'],
|
||||
},
|
||||
},
|
||||
'@mui/material/styles': {
|
||||
styled: {
|
||||
canonicalImport: ['@emotion/styled', 'default'],
|
||||
styledBaseImport: ['@mui/material/styles', 'styled'],
|
||||
},
|
||||
},
|
||||
},
|
||||
transpilePackages: [
|
||||
'@mui/material',
|
||||
'@mui/system',
|
||||
'@mui/icons-material',
|
||||
],
|
||||
env: {
|
||||
// Sentry reads this env var to set the "release" value.
|
||||
// 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
|
||||
webpack: (config, { isServer }) => {
|
||||
if (!isServer) {
|
||||
config.resolve.fallback.fs = false;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
},
|
||||
{
|
||||
dryRun: phase === PHASE_DEVELOPMENT_SERVER,
|
||||
release: gitSHA,
|
||||
},
|
||||
transpilePackages: ['@mui/material', '@mui/system', '@mui/icons-material'],
|
||||
|
||||
// https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j
|
||||
webpack: (config, { isServer }) => {
|
||||
if (!isServer) {
|
||||
config.resolve.fallback.fs = false;
|
||||
}
|
||||
);
|
||||
return config;
|
||||
},
|
||||
|
||||
// Build time Sentry configuration
|
||||
sentry: {
|
||||
widenClientFileUpload: true,
|
||||
},
|
||||
};
|
||||
|
||||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
|
||||
const createSentryWebpackPluginOptions = (phase) => {
|
||||
return {
|
||||
dryRun: phase === PHASE_DEVELOPMENT_SERVER,
|
||||
release: gitSHA,
|
||||
};
|
||||
};
|
||||
|
||||
// withSentryConfig extends the default Next.js usage of webpack to
|
||||
// 1. Initialize the SDK on client page load (`sentry.client.config.ts`)
|
||||
// 2. Upload sourcemaps (using the settings defined in `.sentryclirc`)
|
||||
module.exports = (phase) =>
|
||||
withSentryConfig(nextConfig, createSentryWebpackPluginOptions(phase));
|
||||
|
|
|
@ -3,7 +3,7 @@ import { getSentryUserID } from '@ente/shared/sentry/utils';
|
|||
import { runningInBrowser } from '@ente/shared/platform';
|
||||
import { getHasOptedOutOfCrashReports } from '@ente/shared/storage/localStorage/helpers';
|
||||
|
||||
export const setupSentry = async (dsn: string) => {
|
||||
export const initSentry = async (dsn: string) => {
|
||||
const optedOut = runningInBrowser() && getHasOptedOutOfCrashReports();
|
||||
if (optedOut) return;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
"NEXT_PUBLIC_ENTE_ALBUM_ENDPOINT",
|
||||
"NEXT_PUBLIC_ENTE_FAMILY_PORTAL_ENDPOINT",
|
||||
"NODE_ENV",
|
||||
"SENTRY_AUTH_TOKEN",
|
||||
"SENTRY_RELEASE"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue