mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-24 20:03:41 +03:00
fix(sentry): added fix
This commit is contained in:
parent
3918ad3015
commit
b444761622
@ -76,10 +76,10 @@ def check_user_limit(
|
|||||||
):
|
):
|
||||||
if user.user_openai_api_key is None:
|
if user.user_openai_api_key is None:
|
||||||
date = time.strftime("%Y%m%d")
|
date = time.strftime("%Y%m%d")
|
||||||
max_requests_number = os.getenv("MAX_REQUESTS_NUMBER", 1000)
|
max_requests_number = int(os.getenv("MAX_REQUESTS_NUMBER", 1000))
|
||||||
|
|
||||||
user.increment_user_request_count(date)
|
user.increment_user_request_count(date)
|
||||||
if str(user.requests_count) >= str(max_requests_number):
|
if int(user.requests_count) >= int(max_requests_number):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=429,
|
status_code=429,
|
||||||
detail="You have reached the maximum number of requests for today.",
|
detail="You have reached the maximum number of requests for today.",
|
||||||
|
@ -1,44 +1,41 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
|
||||||
const nextConfig = {};
|
const nextConfig = {};
|
||||||
|
|
||||||
// Check if the SENTRY_DSN environment variable is defined
|
module.exports = nextConfig;
|
||||||
if (process.env.SENTRY_DSN) {
|
|
||||||
// SENTRY_DSN exists, include Sentry configuration
|
|
||||||
const { withSentryConfig } = require("@sentry/nextjs");
|
|
||||||
|
|
||||||
module.exports = withSentryConfig(
|
|
||||||
nextConfig,
|
|
||||||
{
|
|
||||||
// For all available options, see:
|
|
||||||
// https://github.com/getsentry/sentry-webpack-plugin#options
|
|
||||||
|
|
||||||
// Suppresses source map uploading logs during build
|
// // Injected content via Sentry wizard below
|
||||||
silent: true,
|
|
||||||
|
|
||||||
org: "quivr-0f",
|
// const { withSentryConfig } = require("@sentry/nextjs");
|
||||||
project: "javascript-nextjs",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// For all available options, see:
|
|
||||||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
|
|
||||||
|
|
||||||
// Upload a larger set of source maps for prettier stack traces (increases build time)
|
// module.exports = withSentryConfig(
|
||||||
widenClientFileUpload: true,
|
// module.exports,
|
||||||
|
// {
|
||||||
|
// // For all available options, see:
|
||||||
|
// // https://github.com/getsentry/sentry-webpack-plugin#options
|
||||||
|
|
||||||
// Transpiles SDK to be compatible with IE11 (increases bundle size)
|
// // Suppresses source map uploading logs during build
|
||||||
transpileClientSDK: true,
|
// silent: true,
|
||||||
|
|
||||||
// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
|
// org: "quivr-0f",
|
||||||
tunnelRoute: "/monitoring",
|
// project: "javascript-nextjs",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// // For all available options, see:
|
||||||
|
// // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
|
||||||
|
|
||||||
// Hides source maps from generated client bundles
|
// // Upload a larger set of source maps for prettier stack traces (increases build time)
|
||||||
hideSourceMaps: true,
|
// widenClientFileUpload: true,
|
||||||
|
|
||||||
// Automatically tree-shake Sentry logger statements to reduce bundle size
|
// // Transpiles SDK to be compatible with IE11 (increases bundle size)
|
||||||
disableLogger: true,
|
// transpileClientSDK: true,
|
||||||
}
|
|
||||||
);
|
// // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
|
||||||
} else {
|
// tunnelRoute: "/monitoring",
|
||||||
// SENTRY_DSN does not exist, export nextConfig without Sentry
|
|
||||||
module.exports = nextConfig;
|
// // Hides source maps from generated client bundles
|
||||||
}
|
// hideSourceMaps: true,
|
||||||
|
|
||||||
|
// // Automatically tree-shake Sentry logger statements to reduce bundle size
|
||||||
|
// disableLogger: true,
|
||||||
|
// }
|
||||||
|
// );
|
@ -1,38 +1,38 @@
|
|||||||
// This file configures the initialization of Sentry on the client.
|
// // 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.
|
// // 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/
|
// // https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
||||||
|
|
||||||
import * as Sentry from "@sentry/nextjs";
|
// import * as Sentry from "@sentry/nextjs";
|
||||||
|
|
||||||
// Get the DSN from the environment variable
|
// // Get the DSN from the environment variable
|
||||||
const SENTRY_DSN = process.env.SENTRY_DSN;
|
// const SENTRY_DSN = process.env.SENTRY_DSN;
|
||||||
|
|
||||||
// Only initialize Sentry if the DSN is set
|
// // Only initialize Sentry if the DSN is set
|
||||||
if (SENTRY_DSN) {
|
// if (SENTRY_DSN) {
|
||||||
Sentry.init({
|
// Sentry.init({
|
||||||
dsn: SENTRY_DSN,
|
// dsn: SENTRY_DSN,
|
||||||
|
|
||||||
// Adjust this value in production, or use tracesSampler for greater control
|
// // Adjust this value in production, or use tracesSampler for greater control
|
||||||
tracesSampleRate: 1,
|
// tracesSampleRate: 1,
|
||||||
|
|
||||||
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
// // Setting this option to true will print useful information to the console while you're setting up Sentry.
|
||||||
debug: false,
|
// debug: false,
|
||||||
|
|
||||||
replaysOnErrorSampleRate: 1.0,
|
// replaysOnErrorSampleRate: 1.0,
|
||||||
|
|
||||||
// This sets the sample rate to be 10%. You may want this to be 100% while
|
// // 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
|
// // in development and sample at a lower rate in production
|
||||||
replaysSessionSampleRate: 0.1,
|
// replaysSessionSampleRate: 0.1,
|
||||||
|
|
||||||
// You can remove this option if you're not planning to use the Sentry Session Replay feature:
|
// // You can remove this option if you're not planning to use the Sentry Session Replay feature:
|
||||||
integrations: [
|
// integrations: [
|
||||||
new Sentry.Replay({
|
// new Sentry.Replay({
|
||||||
// Additional Replay configuration goes in here, for example:
|
// // Additional Replay configuration goes in here, for example:
|
||||||
maskAllText: true,
|
// maskAllText: true,
|
||||||
blockAllMedia: true,
|
// blockAllMedia: true,
|
||||||
}),
|
// }),
|
||||||
],
|
// ],
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
console.log("Sentry is not initialized as SENTRY_DSN is not set");
|
// console.log("Sentry is not initialized as SENTRY_DSN is not set");
|
||||||
}
|
// }
|
@ -1,19 +1,19 @@
|
|||||||
import * as Sentry from "@sentry/nextjs";
|
// import * as Sentry from "@sentry/nextjs";
|
||||||
|
|
||||||
// Get the DSN from the environment variable
|
// // Get the DSN from the environment variable
|
||||||
const SENTRY_DSN = process.env.SENTRY_DSN;
|
// const SENTRY_DSN = process.env.SENTRY_DSN;
|
||||||
|
|
||||||
// Only initialize Sentry if the DSN is set
|
// // Only initialize Sentry if the DSN is set
|
||||||
if (SENTRY_DSN) {
|
// if (SENTRY_DSN) {
|
||||||
Sentry.init({
|
// Sentry.init({
|
||||||
dsn: SENTRY_DSN,
|
// dsn: SENTRY_DSN,
|
||||||
|
|
||||||
// Adjust this value in production, or use tracesSampler for greater control
|
// // Adjust this value in production, or use tracesSampler for greater control
|
||||||
tracesSampleRate: 1,
|
// tracesSampleRate: 1,
|
||||||
|
|
||||||
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
// // Setting this option to true will print useful information to the console while you're setting up Sentry.
|
||||||
debug: false,
|
// debug: false,
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
console.log("Sentry is not initialized on the server as SENTRY_DSN is not set");
|
// console.log("Sentry is not initialized on the server as SENTRY_DSN is not set");
|
||||||
}
|
// }
|
@ -1,19 +1,19 @@
|
|||||||
import * as Sentry from "@sentry/nextjs";
|
// import * as Sentry from "@sentry/nextjs";
|
||||||
|
|
||||||
// Get the DSN from the environment variable
|
// // Get the DSN from the environment variable
|
||||||
const SENTRY_DSN = process.env.SENTRY_DSN;
|
// const SENTRY_DSN = process.env.SENTRY_DSN;
|
||||||
|
|
||||||
// Only initialize Sentry if the DSN is set
|
// // Only initialize Sentry if the DSN is set
|
||||||
if (SENTRY_DSN) {
|
// if (SENTRY_DSN) {
|
||||||
Sentry.init({
|
// Sentry.init({
|
||||||
dsn: SENTRY_DSN,
|
// dsn: SENTRY_DSN,
|
||||||
|
|
||||||
// Adjust this value in production, or use tracesSampler for greater control
|
// // Adjust this value in production, or use tracesSampler for greater control
|
||||||
tracesSampleRate: 1,
|
// tracesSampleRate: 1,
|
||||||
|
|
||||||
// Setting this option to true will print useful information to the console while you're setting up Sentry.
|
// // Setting this option to true will print useful information to the console while you're setting up Sentry.
|
||||||
debug: false,
|
// debug: false,
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
console.log("Sentry is not initialized on the server as SENTRY_DSN is not set");
|
// console.log("Sentry is not initialized on the server as SENTRY_DSN is not set");
|
||||||
}
|
// }
|
Loading…
Reference in New Issue
Block a user