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.

do check in getter

Sara Vieira614a4a3e25d8
diff --git a/app/shared/env/env-getter.ts b/app/shared/env/env-getter.ts
index 0bdbdf1045..7ff6333ac6 100644
--- a/app/shared/env/env-getter.ts
+++ b/app/shared/env/env-getter.ts
@@ -9,6 +9,9 @@ export default new Proxy(
{
get(_target, prop) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
+ if (typeof window === "undefined") {
+ return process.env;
+ }
const env = (window[namespace as any] ?? {}) as unknown as Env;
return prop in env ? env[prop as keyof Env] : undefined;
},
diff --git a/app/shared/sentry.ts b/app/shared/sentry.ts
index a6599dfdf7..1269bfd359 100644
--- a/app/shared/sentry.ts
+++ b/app/shared/sentry.ts
@@ -3,20 +3,16 @@ 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_DSN
+export const initSentry = () =>
+ env.SENTRY_DSN
? Sentry.init({
- dsn: SENTRY_DSN,
+ dsn: env.SENTRY_DSN,
integrations: [new BrowserTracing()],
tracesSampleRate: 1.0,
- environment: VERCEL_ENV || "development",
+ environment: env.VERCEL_ENV || "development",
})
: () => null;
-};
+
type SentryHelperProps = {
message: string;
extra?: Extras;
@@ -28,7 +24,7 @@ export const sentryMessage = ({
extra,
skipLogging = false,
}: SentryHelperProps) => {
- if (SENTRY_DSN) {
+ if (env.SENTRY_DSN) {
Sentry.withScope((scope) => {
if (extra) scope.setExtras(extra);
Sentry.captureMessage(message);
@@ -46,7 +42,7 @@ export const sentryException = ({
extra,
skipLogging = false,
}: SentryHelperProps) => {
- if (SENTRY_DSN) {
+ if (env.SENTRY_DSN) {
Sentry.withScope((scope) => {
if (extra) scope.setExtras(extra);
Sentry.captureException(message);