diff --git a/app/entry.client.tsx b/app/entry.client.tsx index 79bcc13..f1818ad 100644 --- a/app/entry.client.tsx +++ b/app/entry.client.tsx @@ -20,6 +20,10 @@ Sentry.init({ ], replaysOnErrorSampleRate: 1, replaysSessionSampleRate: 0.02, + release: + document + .querySelector("meta[name='commit_sha']") + ?.getAttribute("content") ?? undefined, sendDefaultPii: true, tracesSampleRate: 0.1, tunnel: "/api/st", diff --git a/app/root.tsx b/app/root.tsx index df9a112..745038a 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -130,6 +130,7 @@ export async function loader({ }): Promise<{ [k: string]: any }> { let data: { [k: string]: string } = {}; + if (context.env.COMMIT_SHA) data.commit_sha = context.env.COMMIT_SHA; if (context.data.current_user) data = { ...context.data.current_user }; if (context.env.REMIX_DSN) data.dsn = context.env.REMIX_DSN; if (context.data.nonce) data.nonce = context.data.nonce; @@ -202,6 +203,9 @@ function DocumentWrapper(props: { /> ))} + {loaderData.commit_sha ? ( + + ) : null} {loaderData.dsn ? ( ) : null} diff --git a/functions/_middleware.ts b/functions/_middleware.ts index c2ca4a6..f750777 100644 --- a/functions/_middleware.ts +++ b/functions/_middleware.ts @@ -383,6 +383,7 @@ async function setTheme(context: RequestContext) { export const onRequest = [ Sentry.sentryPagesPlugin((context: RequestContext) => ({ dsn: context.env.FUNCTIONS_DSN, + release: context.env.COMMIT_SHA, sendDefaultPii: true, })), setAuth,