feat: implement sentry cli

This commit is contained in:
AykutSarac 2023-05-22 11:49:38 +03:00
parent 5c9ad22aa7
commit 4b91dffd60
No known key found for this signature in database
7 changed files with 68 additions and 17 deletions

View File

@ -100,3 +100,18 @@ jobs:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
# Sentry job
sentry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Sentry Release
uses: getsentry/action-release@v1.0.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
sourcemaps: ./out

4
.gitignore vendored
View File

@ -39,4 +39,6 @@ yarn-error.log*
# PWA workers
**/public/workbox-*.js
**/public/sw.js
**/public/fallback-*.js
**/public/fallback-*.js
# Sentry Auth Token
.sentryclirc

View File

@ -1,9 +1,4 @@
const withBundleAnalyzer =
process.env.ANALYZE === "true"
? require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
})()
: x => x;
const { withSentryConfig } = require("@sentry/nextjs");
/**
* @type {import('next').NextConfig}
@ -16,4 +11,16 @@ const config = {
},
};
module.exports = withBundleAnalyzer(config);
module.exports = withSentryConfig(
config,
{
silent: true,
org: "aykut-sarac",
project: "json-crack",
},
{
widenClientFileUpload: true,
hideSourceMaps: true,
disableLogger: true,
}
);

30
sentry.client.config.ts Normal file
View File

@ -0,0 +1,30 @@
// This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from "@sentry/nextjs";
Sentry.init({
enabled: process.env.NODE_ENV === "development",
dsn: "https://d3345591295d4dd1b8c579b62003d939@o1284435.ingest.sentry.io/6495191",
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 0.2,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
replaysOnErrorSampleRate: 1.0,
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
new Sentry.Replay({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});

3
sentry.edge.config.ts Normal file
View File

@ -0,0 +1,3 @@
{
/* empty */
}

3
sentry.server.config.ts Normal file
View File

@ -0,0 +1,3 @@
{
/* empty */
}

View File

@ -3,7 +3,6 @@ import type { AppProps } from "next/app";
import localFont from "next/font/local";
import { ThemeProvider } from "styled-components";
import { MantineProvider } from "@mantine/core";
import { init } from "@sentry/nextjs";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { Toaster } from "react-hot-toast";
import { GoogleAnalytics } from "src/components/GoogleAnalytics";
@ -13,14 +12,6 @@ import { ExternalMode } from "src/layout/DevMode";
import { ModalController } from "src/layout/ModalController";
import useStored from "src/store/useStored";
if (process.env.NODE_ENV !== "development") {
init({
dsn: "https://d3345591295d4dd1b8c579b62003d939@o1284435.ingest.sentry.io/6495191",
tracesSampleRate: 0.25,
release: "production",
});
}
const queryClient = new QueryClient({
defaultOptions: {
queries: {