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 USE_DEV_COLORS
|
||||||
ARG BASE_PATH
|
ARG BASE_PATH
|
||||||
ARG SENTRY_DSN
|
ARG SENTRY_DSN
|
||||||
|
ARG SENTRY_AUTH_TOKEN
|
||||||
|
ARG SENTRY_ENVIRONMENT
|
||||||
ARG SENTRYCLI_CDNURL
|
ARG SENTRYCLI_CDNURL
|
||||||
ARG URL_GET_USER_DIRECT
|
ARG URL_GET_USER_DIRECT
|
||||||
ARG URL_CRM_GRAPHQL_DIRECT
|
ARG URL_CRM_GRAPHQL_DIRECT
|
||||||
|
|||||||
@ -3,7 +3,9 @@ const { z } = require('zod');
|
|||||||
const envSchema = z.object({
|
const envSchema = z.object({
|
||||||
BASE_PATH: z.string().optional().default(''),
|
BASE_PATH: z.string().optional().default(''),
|
||||||
PORT: z.string().optional(),
|
PORT: z.string().optional(),
|
||||||
|
SENTRY_AUTH_TOKEN: z.string(),
|
||||||
SENTRY_DSN: z.string(),
|
SENTRY_DSN: z.string(),
|
||||||
|
SENTRY_ENVIRONMENT: z.string(),
|
||||||
URL_1C_TRANSTAX_DIRECT: z.string(),
|
URL_1C_TRANSTAX_DIRECT: z.string(),
|
||||||
URL_CORE_CALCULATE_DIRECT: z.string(),
|
URL_CORE_CALCULATE_DIRECT: z.string(),
|
||||||
URL_CORE_FINGAP_DIRECT: z.string(),
|
URL_CORE_FINGAP_DIRECT: z.string(),
|
||||||
|
|||||||
@ -3,6 +3,7 @@ const envSchema = require('./env');
|
|||||||
const publicRuntimeConfigSchema = envSchema.pick({
|
const publicRuntimeConfigSchema = envSchema.pick({
|
||||||
BASE_PATH: true,
|
BASE_PATH: true,
|
||||||
SENTRY_DSN: true,
|
SENTRY_DSN: true,
|
||||||
|
SENTRY_ENVIRONMENT: true,
|
||||||
USE_DEV_COLORS: true,
|
USE_DEV_COLORS: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ const serverRuntimeConfigSchema = envSchema.pick({
|
|||||||
BASE_PATH: true,
|
BASE_PATH: true,
|
||||||
PORT: true,
|
PORT: true,
|
||||||
SENTRY_DSN: true,
|
SENTRY_DSN: true,
|
||||||
|
SENTRY_ENVIRONMENT: true,
|
||||||
URL_1C_TRANSTAX_DIRECT: true,
|
URL_1C_TRANSTAX_DIRECT: true,
|
||||||
URL_CORE_CALCULATE_DIRECT: true,
|
URL_CORE_CALCULATE_DIRECT: true,
|
||||||
URL_CORE_FINGAP_DIRECT: true,
|
URL_CORE_FINGAP_DIRECT: true,
|
||||||
|
|||||||
@ -18,73 +18,92 @@ function buildFaviconRewrite(source) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = withSentryConfig({
|
module.exports = withSentryConfig(
|
||||||
basePath: env.BASE_PATH,
|
{
|
||||||
compiler: {
|
basePath: env.BASE_PATH,
|
||||||
styledComponents: true,
|
compiler: {
|
||||||
|
styledComponents: true,
|
||||||
|
},
|
||||||
|
eslint: {
|
||||||
|
ignoreDuringBuilds: true,
|
||||||
|
},
|
||||||
|
experimental: {
|
||||||
|
outputFileTracingRoot: path.join(__dirname, '../../'),
|
||||||
|
},
|
||||||
|
images: {
|
||||||
|
deviceSizes: devices,
|
||||||
|
},
|
||||||
|
output: 'standalone',
|
||||||
|
publicRuntimeConfig: publicRuntimeConfigSchema.parse(env),
|
||||||
|
reactStrictMode: true,
|
||||||
|
async rewrites() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
destination: env.URL_CRM_GRAPHQL_PROXY + '/:path*',
|
||||||
|
source: urls.URL_CRM_GRAPHQL_PROXY + '/:path*',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
destination: env.URL_CRM_DOWNLOADKP_BASE + '/:path*',
|
||||||
|
source: urls.URL_CRM_DOWNLOADKP_PROXY + '/:path*',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
destination: env.URL_GET_USER_DIRECT,
|
||||||
|
source: urls.URL_GET_USER_PROXY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
destination: env.URL_CORE_FINGAP_DIRECT,
|
||||||
|
source: urls.URL_CORE_FINGAP_PROXY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
destination: env.URL_1C_TRANSTAX_DIRECT,
|
||||||
|
source: urls.URL_1C_TRANSTAX_PROXY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
destination: env.URL_ELT_KASKO_DIRECT,
|
||||||
|
source: urls.URL_ELT_KASKO_PROXY,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
destination: env.URL_ELT_OSAGO_DIRECT,
|
||||||
|
source: urls.URL_ELT_OSAGO_PROXY,
|
||||||
|
},
|
||||||
|
...favicons.map((fileName) => buildFaviconRewrite(`/${fileName}`)),
|
||||||
|
];
|
||||||
|
},
|
||||||
|
sentry: {
|
||||||
|
disableClientWebpackPlugin: true,
|
||||||
|
disableServerWebpackPlugin: true,
|
||||||
|
hideSourceMaps: true,
|
||||||
|
tunnelRoute: '/track-error',
|
||||||
|
},
|
||||||
|
serverRuntimeConfig: serverRuntimeConfigSchema.parse(env),
|
||||||
|
swcMinify: true,
|
||||||
|
transpilePackages: [
|
||||||
|
'ui',
|
||||||
|
'tools',
|
||||||
|
'antd',
|
||||||
|
'@ant-design/icons',
|
||||||
|
'rc-pagination',
|
||||||
|
'rc-picker',
|
||||||
|
'@ant-design',
|
||||||
|
'@rc-component',
|
||||||
|
'rc-table',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
eslint: {
|
{
|
||||||
ignoreDuringBuilds: true,
|
authToken: env.SENTRY_AUTH_TOKEN,
|
||||||
|
org: 'sentry',
|
||||||
|
project: 'calculator-client',
|
||||||
|
silent: true,
|
||||||
|
url: 'https://errors.evoleasing.ru/',
|
||||||
},
|
},
|
||||||
experimental: {
|
{
|
||||||
outputFileTracingRoot: path.join(__dirname, '../../'),
|
automaticVercelMonitors: true,
|
||||||
},
|
|
||||||
images: {
|
|
||||||
deviceSizes: devices,
|
|
||||||
},
|
|
||||||
output: 'standalone',
|
|
||||||
publicRuntimeConfig: publicRuntimeConfigSchema.parse(env),
|
|
||||||
reactStrictMode: true,
|
|
||||||
async rewrites() {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
destination: env.URL_CRM_GRAPHQL_PROXY + '/:path*',
|
|
||||||
source: urls.URL_CRM_GRAPHQL_PROXY + '/:path*',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
destination: env.URL_CRM_DOWNLOADKP_BASE + '/:path*',
|
|
||||||
source: urls.URL_CRM_DOWNLOADKP_PROXY + '/:path*',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
destination: env.URL_GET_USER_DIRECT,
|
|
||||||
source: urls.URL_GET_USER_PROXY,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
destination: env.URL_CORE_FINGAP_DIRECT,
|
|
||||||
source: urls.URL_CORE_FINGAP_PROXY,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
destination: env.URL_1C_TRANSTAX_DIRECT,
|
|
||||||
source: urls.URL_1C_TRANSTAX_PROXY,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
destination: env.URL_ELT_KASKO_DIRECT,
|
|
||||||
source: urls.URL_ELT_KASKO_PROXY,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
destination: env.URL_ELT_OSAGO_DIRECT,
|
|
||||||
source: urls.URL_ELT_OSAGO_PROXY,
|
|
||||||
},
|
|
||||||
...favicons.map((fileName) => buildFaviconRewrite(`/${fileName}`)),
|
|
||||||
];
|
|
||||||
},
|
|
||||||
sentry: {
|
|
||||||
disableClientWebpackPlugin: true,
|
disableClientWebpackPlugin: true,
|
||||||
|
disableLogger: true,
|
||||||
disableServerWebpackPlugin: true,
|
disableServerWebpackPlugin: true,
|
||||||
hideSourceMaps: true,
|
hideSourceMaps: true,
|
||||||
|
transpileClientSDK: false,
|
||||||
tunnelRoute: '/track-error',
|
tunnelRoute: '/track-error',
|
||||||
},
|
widenClientFileUpload: true,
|
||||||
serverRuntimeConfig: serverRuntimeConfigSchema.parse(env),
|
}
|
||||||
swcMinify: true,
|
);
|
||||||
transpilePackages: [
|
|
||||||
'ui',
|
|
||||||
'tools',
|
|
||||||
'antd',
|
|
||||||
'@ant-design/icons',
|
|
||||||
'rc-pagination',
|
|
||||||
'rc-picker',
|
|
||||||
'@ant-design',
|
|
||||||
'@rc-component',
|
|
||||||
'rc-table',
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|||||||
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/
|
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
||||||
|
|
||||||
import getUrls from './config/urls';
|
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 { SENTRY_DSN } = getUrls();
|
||||||
|
|
||||||
|
const { publicRuntimeConfig } = getConfig();
|
||||||
|
const { SENTRY_ENVIRONMENT } = publicRuntimeConfigSchema.parse(publicRuntimeConfig);
|
||||||
|
|
||||||
init({
|
init({
|
||||||
|
debug: false,
|
||||||
dsn: SENTRY_DSN,
|
dsn: SENTRY_DSN,
|
||||||
|
environment: SENTRY_ENVIRONMENT,
|
||||||
|
|
||||||
integrations: [],
|
integrations: [
|
||||||
|
replayIntegration({
|
||||||
// If the entire session is not sampled, use the below sample rate to sample
|
blockAllMedia: true,
|
||||||
|
maskAllText: false,
|
||||||
// sessions when an error occurs.
|
}),
|
||||||
|
],
|
||||||
replaysOnErrorSampleRate: 1,
|
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,
|
replaysSessionSampleRate: 0.1,
|
||||||
|
|
||||||
// Adjust this value in production, or use tracesSampler for greater control
|
|
||||||
|
|
||||||
tracesSampleRate: 1,
|
tracesSampleRate: 1,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -8,11 +8,7 @@ import { init } from '@sentry/nextjs';
|
|||||||
const { SENTRY_DSN } = getUrls();
|
const { SENTRY_DSN } = getUrls();
|
||||||
|
|
||||||
init({
|
init({
|
||||||
|
debug: false,
|
||||||
dsn: SENTRY_DSN,
|
dsn: SENTRY_DSN,
|
||||||
// Adjust this value in production, or use tracesSampler for greater control
|
|
||||||
tracesSampleRate: 1,
|
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();
|
const { SENTRY_DSN } = getUrls();
|
||||||
|
|
||||||
init({
|
init({
|
||||||
|
debug: false,
|
||||||
|
|
||||||
dsn: SENTRY_DSN,
|
dsn: SENTRY_DSN,
|
||||||
// Adjust this value in production, or use tracesSampler for greater control
|
|
||||||
tracesSampleRate: 1,
|
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}
|
- BASE_PATH=${BASE_PATH}
|
||||||
- SENTRY_DSN=${SENTRY_DSN}
|
- SENTRY_DSN=${SENTRY_DSN}
|
||||||
- SENTRYCLI_CDNURL=${SENTRYCLI_CDNURL}
|
- SENTRYCLI_CDNURL=${SENTRYCLI_CDNURL}
|
||||||
|
- SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
|
||||||
|
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}
|
||||||
- URL_GET_USER_DIRECT=${URL_GET_USER_DIRECT}
|
- URL_GET_USER_DIRECT=${URL_GET_USER_DIRECT}
|
||||||
- URL_CRM_GRAPHQL_DIRECT=${URL_CRM_GRAPHQL_DIRECT}
|
- URL_CRM_GRAPHQL_DIRECT=${URL_CRM_GRAPHQL_DIRECT}
|
||||||
- URL_CRM_GRAPHQL_PROXY=${URL_CRM_GRAPHQL_PROXY}
|
- URL_CRM_GRAPHQL_PROXY=${URL_CRM_GRAPHQL_PROXY}
|
||||||
@ -22,6 +24,8 @@ services:
|
|||||||
- BASE_PATH=${BASE_PATH}
|
- BASE_PATH=${BASE_PATH}
|
||||||
- SENTRY_DSN=${SENTRY_DSN}
|
- SENTRY_DSN=${SENTRY_DSN}
|
||||||
- SENTRYCLI_CDNURL=${SENTRYCLI_CDNURL}
|
- SENTRYCLI_CDNURL=${SENTRYCLI_CDNURL}
|
||||||
|
- SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
|
||||||
|
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}
|
||||||
- URL_GET_USER_DIRECT=${URL_GET_USER_DIRECT}
|
- URL_GET_USER_DIRECT=${URL_GET_USER_DIRECT}
|
||||||
- URL_CRM_GRAPHQL_DIRECT=${URL_CRM_GRAPHQL_DIRECT}
|
- URL_CRM_GRAPHQL_DIRECT=${URL_CRM_GRAPHQL_DIRECT}
|
||||||
- URL_CRM_GRAPHQL_PROXY=${URL_CRM_GRAPHQL_PROXY}
|
- URL_CRM_GRAPHQL_PROXY=${URL_CRM_GRAPHQL_PROXY}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user