Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix in server

Sara Vieira7cc25a48f737
diff --git a/app/dashboard/dashboard.tsx b/app/dashboard/dashboard.tsx
index 396878ba49..2f4ac3b95b 100644
--- a/app/dashboard/dashboard.tsx
+++ b/app/dashboard/dashboard.tsx
@@ -28,7 +28,6 @@ type DashboardProps = {
export const Dashboard = ({ projects = [], config, user }: DashboardProps) => {
const actionData = useActionData();
-
return (
<>
<DashboardHeader user={user} />
diff --git a/app/env.server.ts b/app/env.server.ts
index 170548e349..90fa727197 100644
--- a/app/env.server.ts
+++ b/app/env.server.ts
@@ -2,6 +2,7 @@
// Never use a private key here, because it will become public.
const env = {
SENTRY_DSN: process.env.SENTRY_DSN,
+ VERCEL_ENV: process.env.VERCEL_ENV,
} as const;
export default env;
diff --git a/app/routes/dashboard/index.tsx b/app/routes/dashboard/index.tsx
index d3dea88b88..6dfbbf0ef8 100644
--- a/app/routes/dashboard/index.tsx
+++ b/app/routes/dashboard/index.tsx
@@ -10,7 +10,6 @@ import * as db from "~/shared/db";
import config from "~/config";
import { ensureUserCookie } from "~/shared/session";
import { authenticator } from "~/services/auth.server";
-
export { links };
export const action: ActionFunction = async ({ request }) => {
diff --git a/app/shared/sentry.ts b/app/shared/sentry.ts
index 76074712b4..a6599dfdf7 100644
--- a/app/shared/sentry.ts
+++ b/app/shared/sentry.ts
@@ -3,14 +3,19 @@ import { Extras } from "@sentry/types";
import { BrowserTracing } from "@sentry/tracing";
import env from "~/shared/env";
+const SENTRY_DSN =
+ typeof window !== "undefined" ? env.SENTRY_DSN : process.env.SENTRY_DSN;
+const VERCEL_ENV =
+ typeof window !== "undefined" ? env.VERCEL_ENV : process.env.VERCEL_ENV;
export const initSentry = () => {
- Sentry.init({
- dsn: env.SENTRY_DSN,
- integrations: [new BrowserTracing()],
- tracesSampleRate: 1.0,
- environment:
- process.env.NODE_ENV === "development" ? "development" : "production",
- });
+ SENTRY_DSN
+ ? Sentry.init({
+ dsn: SENTRY_DSN,
+ integrations: [new BrowserTracing()],
+ tracesSampleRate: 1.0,
+ environment: VERCEL_ENV || "development",
+ })
+ : () => null;
};
type SentryHelperProps = {
message: string;
@@ -23,10 +28,12 @@ export const sentryMessage = ({
extra,
skipLogging = false,
}: SentryHelperProps) => {
- Sentry.withScope((scope) => {
- if (extra) scope.setExtras(extra);
- Sentry.captureMessage(message);
- });
+ if (SENTRY_DSN) {
+ Sentry.withScope((scope) => {
+ if (extra) scope.setExtras(extra);
+ Sentry.captureMessage(message);
+ });
+ }
if (skipLogging !== true) {
// eslint-disable-next-line no-console
@@ -39,11 +46,12 @@ export const sentryException = ({
extra,
skipLogging = false,
}: SentryHelperProps) => {
- Sentry.withScope((scope) => {
- if (extra) scope.setExtras(extra);
- Sentry.captureException(message);
- });
-
+ if (SENTRY_DSN) {
+ Sentry.withScope((scope) => {
+ if (extra) scope.setExtras(extra);
+ Sentry.captureException(message);
+ });
+ }
if (skipLogging !== true) {
// eslint-disable-next-line no-console
console.error(message);