apps/web: reconfigure sentry
This commit is contained in:
parent
59e45ddc63
commit
e258873976
3
apps/web/.gitignore
vendored
Normal file
3
apps/web/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
# Sentry Config File
|
||||
.sentryclirc
|
||||
@ -29,6 +29,8 @@ COPY turbo.json turbo.json
|
||||
ARG USE_DEV_COLORS
|
||||
ARG BASE_PATH
|
||||
ARG SENTRY_DSN
|
||||
ARG SENTRY_AUTH_TOKEN
|
||||
ARG SENTRY_ENVIRONMENT
|
||||
ARG SENTRYCLI_CDNURL
|
||||
ARG URL_GET_USER_DIRECT
|
||||
ARG URL_CRM_GRAPHQL_DIRECT
|
||||
|
||||
@ -3,7 +3,9 @@ const { z } = require('zod');
|
||||
const envSchema = z.object({
|
||||
BASE_PATH: z.string().optional().default(''),
|
||||
PORT: z.string().optional(),
|
||||
SENTRY_AUTH_TOKEN: z.string(),
|
||||
SENTRY_DSN: z.string(),
|
||||
SENTRY_ENVIRONMENT: z.string(),
|
||||
URL_1C_TRANSTAX_DIRECT: z.string(),
|
||||
URL_CORE_CALCULATE_DIRECT: z.string(),
|
||||
URL_CORE_FINGAP_DIRECT: z.string(),
|
||||
|
||||
@ -3,6 +3,7 @@ const envSchema = require('./env');
|
||||
const publicRuntimeConfigSchema = envSchema.pick({
|
||||
BASE_PATH: true,
|
||||
SENTRY_DSN: true,
|
||||
SENTRY_ENVIRONMENT: true,
|
||||
USE_DEV_COLORS: true,
|
||||
});
|
||||
|
||||
@ -10,6 +11,7 @@ const serverRuntimeConfigSchema = envSchema.pick({
|
||||
BASE_PATH: true,
|
||||
PORT: true,
|
||||
SENTRY_DSN: true,
|
||||
SENTRY_ENVIRONMENT: true,
|
||||
URL_1C_TRANSTAX_DIRECT: true,
|
||||
URL_CORE_CALCULATE_DIRECT: true,
|
||||
URL_CORE_FINGAP_DIRECT: true,
|
||||
|
||||
@ -18,7 +18,8 @@ function buildFaviconRewrite(source) {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = withSentryConfig({
|
||||
module.exports = withSentryConfig(
|
||||
{
|
||||
basePath: env.BASE_PATH,
|
||||
compiler: {
|
||||
styledComponents: true,
|
||||
@ -87,4 +88,22 @@ module.exports = withSentryConfig({
|
||||
'@rc-component',
|
||||
'rc-table',
|
||||
],
|
||||
});
|
||||
},
|
||||
{
|
||||
authToken: env.SENTRY_AUTH_TOKEN,
|
||||
org: 'sentry',
|
||||
project: 'calculator-client',
|
||||
silent: true,
|
||||
url: 'https://errors.evoleasing.ru/',
|
||||
},
|
||||
{
|
||||
automaticVercelMonitors: true,
|
||||
disableClientWebpackPlugin: true,
|
||||
disableLogger: true,
|
||||
disableServerWebpackPlugin: true,
|
||||
hideSourceMaps: true,
|
||||
transpileClientSDK: false,
|
||||
tunnelRoute: '/track-error',
|
||||
widenClientFileUpload: true,
|
||||
}
|
||||
);
|
||||
|
||||
18
apps/web/pages/_error.jsx
Normal file
18
apps/web/pages/_error.jsx
Normal file
@ -0,0 +1,18 @@
|
||||
/* eslint-disable canonical/no-use-extend-native */
|
||||
import { captureUnderscoreErrorException } from '@sentry/nextjs';
|
||||
import Error from 'next/error';
|
||||
|
||||
function CustomErrorComponent(props) {
|
||||
return <Error statusCode={props.statusCode} />;
|
||||
}
|
||||
|
||||
CustomErrorComponent.getInitialProps = async (contextData) => {
|
||||
// In case this is running in a serverless function, await this in order to give Sentry
|
||||
// time to send the error before the lambda exits
|
||||
await captureUnderscoreErrorException(contextData);
|
||||
|
||||
// This will contain the status code of the response
|
||||
return Error.getInitialProps(contextData);
|
||||
};
|
||||
|
||||
export default CustomErrorComponent;
|
||||
@ -5,33 +5,27 @@
|
||||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
||||
|
||||
import getUrls from './config/urls';
|
||||
import { init } from '@sentry/nextjs';
|
||||
import { publicRuntimeConfigSchema } from '@/config/schema/runtime-config';
|
||||
import { init, replayIntegration } from '@sentry/nextjs';
|
||||
import getConfig from 'next/config';
|
||||
|
||||
const { SENTRY_DSN } = getUrls();
|
||||
|
||||
const { publicRuntimeConfig } = getConfig();
|
||||
const { SENTRY_ENVIRONMENT } = publicRuntimeConfigSchema.parse(publicRuntimeConfig);
|
||||
|
||||
init({
|
||||
debug: false,
|
||||
dsn: SENTRY_DSN,
|
||||
environment: SENTRY_ENVIRONMENT,
|
||||
|
||||
integrations: [],
|
||||
|
||||
// If the entire session is not sampled, use the below sample rate to sample
|
||||
|
||||
// sessions when an error occurs.
|
||||
integrations: [
|
||||
replayIntegration({
|
||||
blockAllMedia: true,
|
||||
maskAllText: false,
|
||||
}),
|
||||
],
|
||||
replaysOnErrorSampleRate: 1,
|
||||
|
||||
// ...
|
||||
|
||||
// Note: if you want to override the automatic release value, do not set a
|
||||
|
||||
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
|
||||
|
||||
// that it will also get attached to your source maps
|
||||
|
||||
// in development and sample at a lower rate in production
|
||||
|
||||
replaysSessionSampleRate: 0.1,
|
||||
|
||||
// Adjust this value in production, or use tracesSampler for greater control
|
||||
|
||||
tracesSampleRate: 1,
|
||||
});
|
||||
|
||||
@ -8,11 +8,7 @@ import { init } from '@sentry/nextjs';
|
||||
const { SENTRY_DSN } = getUrls();
|
||||
|
||||
init({
|
||||
debug: false,
|
||||
dsn: SENTRY_DSN,
|
||||
// Adjust this value in production, or use tracesSampler for greater control
|
||||
tracesSampleRate: 1,
|
||||
// ...
|
||||
// Note: if you want to override the automatic release value, do not set a
|
||||
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
|
||||
// that it will also get attached to your source maps
|
||||
});
|
||||
|
||||
@ -8,11 +8,8 @@ import { init } from '@sentry/nextjs';
|
||||
const { SENTRY_DSN } = getUrls();
|
||||
|
||||
init({
|
||||
debug: false,
|
||||
|
||||
dsn: SENTRY_DSN,
|
||||
// Adjust this value in production, or use tracesSampler for greater control
|
||||
tracesSampleRate: 1,
|
||||
// ...
|
||||
// Note: if you want to override the automatic release value, do not set a
|
||||
// `release` value here - use the environment variable `SENTRY_RELEASE`, so
|
||||
// that it will also get attached to your source maps
|
||||
});
|
||||
|
||||
@ -6,6 +6,8 @@ services:
|
||||
- BASE_PATH=${BASE_PATH}
|
||||
- SENTRY_DSN=${SENTRY_DSN}
|
||||
- SENTRYCLI_CDNURL=${SENTRYCLI_CDNURL}
|
||||
- SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
|
||||
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}
|
||||
- URL_GET_USER_DIRECT=${URL_GET_USER_DIRECT}
|
||||
- URL_CRM_GRAPHQL_DIRECT=${URL_CRM_GRAPHQL_DIRECT}
|
||||
- URL_CRM_GRAPHQL_PROXY=${URL_CRM_GRAPHQL_PROXY}
|
||||
@ -22,6 +24,8 @@ services:
|
||||
- BASE_PATH=${BASE_PATH}
|
||||
- SENTRY_DSN=${SENTRY_DSN}
|
||||
- SENTRYCLI_CDNURL=${SENTRYCLI_CDNURL}
|
||||
- SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
|
||||
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}
|
||||
- URL_GET_USER_DIRECT=${URL_GET_USER_DIRECT}
|
||||
- URL_CRM_GRAPHQL_DIRECT=${URL_CRM_GRAPHQL_DIRECT}
|
||||
- URL_CRM_GRAPHQL_PROXY=${URL_CRM_GRAPHQL_PROXY}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user