From 91931c9bda90a11a63de8304ffe5948fa21a3218 Mon Sep 17 00:00:00 2001 From: Enno Gelhaus Date: Wed, 26 Nov 2025 13:24:34 +0100 Subject: [PATCH 1/3] feat: allow all logs to be passed to sentry --- libraries/nestjs-libraries/src/sentry/initialize.sentry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/nestjs-libraries/src/sentry/initialize.sentry.ts b/libraries/nestjs-libraries/src/sentry/initialize.sentry.ts index 8ff483a2..6ace751c 100644 --- a/libraries/nestjs-libraries/src/sentry/initialize.sentry.ts +++ b/libraries/nestjs-libraries/src/sentry/initialize.sentry.ts @@ -25,7 +25,7 @@ export const initializeSentry = (appName: string, allowLogs = false) => { integrations: [ // Add our Profiling integration nodeProfilingIntegration(), - Sentry.consoleLoggingIntegration({ levels: ['log', 'error', 'warn'] }), + Sentry.consoleLoggingIntegration({ levels: ['log', 'info', 'warn', 'error', 'debug', 'assert', 'trace'] }), Sentry.openAIIntegration({ recordInputs: true, recordOutputs: true, From 24ae266041e3e2322193d32bde9b38ae3b55aa98 Mon Sep 17 00:00:00 2001 From: Enno Gelhaus Date: Wed, 26 Nov 2025 15:33:57 +0100 Subject: [PATCH 2/3] feat: add Sentry console logging integration and user report dialog --- .../sentry/initialize.sentry.next.basic.ts | 31 ++++++++++++++++++- package.json | 1 + pnpm-lock.yaml | 28 +++++++++++------ 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/libraries/react-shared-libraries/src/sentry/initialize.sentry.next.basic.ts b/libraries/react-shared-libraries/src/sentry/initialize.sentry.next.basic.ts index c9361650..0d8a64f3 100644 --- a/libraries/react-shared-libraries/src/sentry/initialize.sentry.next.basic.ts +++ b/libraries/react-shared-libraries/src/sentry/initialize.sentry.next.basic.ts @@ -29,6 +29,9 @@ export const initializeSentryBasic = (environment: string, dsn: string, extensio }, }, }, + integrations: [ + Sentry.consoleLoggingIntegration({ levels: ['log', 'info', 'warn', 'error', 'debug', 'assert', 'trace'] }), + ], environment: environment || 'development', dsn, sendDefaultPii: true, @@ -47,10 +50,36 @@ export const initializeSentryBasic = (environment: string, dsn: string, extensio } } } + + // If there's an exception and an event id, present the user report dialog. + if (event.event_id) { + // Only attempt to show the dialog in a browser environment. + if (typeof window !== 'undefined' && window.document) { + // Dynamically import the package that exports showReportDialog to avoid + // bundler errors when this shared lib is used in non-browser builds. + import('@sentry/react') + .then((mod) => { + try { + mod.showReportDialog({ eventId: event.event_id }); + } catch (err) { + // eslint-disable-next-line no-console + console.error('Sentry.showReportDialog failed:', err); + } + }) + .catch((importErr) => { + // eslint-disable-next-line no-console + console.error('Failed to import @sentry/react for report dialog:', importErr); + }); + } + } } return event; // Send the event to Sentry }, }); - } catch (err) {} + } catch (err) { + // Log initialization errors + // eslint-disable-next-line no-console + console.error('Sentry.init failed:', err); + } }; diff --git a/package.json b/package.json index ab2ca86c..d6446ba6 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "@postiz/wallets": "^0.0.1", "@prisma/client": "6.5.0", "@sentry/nestjs": "^10.25.0", + "@sentry/react": "^10.25.0", "@sentry/nextjs": "^10.25.0", "@sentry/profiling-node": "^10.25.0", "@solana/wallet-adapter-react": "^0.15.35", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1c78d8e3..e3d402cc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,7 +11,7 @@ importers: dependencies: '@ag-ui/mastra': specifier: 0.2.0 - version: 0.2.0(@ag-ui/client@0.0.41)(@ag-ui/core@0.0.37)(@copilotkit/runtime@1.10.6(9c0ec131fe3ef529a831958f12b4bf78))(@mastra/core@0.20.2(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76))(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76) + version: 0.2.0(@ag-ui/client@0.0.41)(@ag-ui/core@0.0.41)(@copilotkit/runtime@1.10.6(6855d89fee41a5dd20a0f9576445cd9f))(@mastra/core@0.20.2(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76))(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76) '@ai-sdk/openai': specifier: ^2.0.52 version: 2.0.68(zod@3.25.76) @@ -38,7 +38,7 @@ importers: version: 1.10.6(@types/react@18.3.1)(graphql@16.12.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@copilotkit/runtime': specifier: 1.10.6 - version: 1.10.6(9c0ec131fe3ef529a831958f12b4bf78) + version: 1.10.6(6855d89fee41a5dd20a0f9576445cd9f) '@hookform/resolvers': specifier: ^3.3.4 version: 3.10.0(react-hook-form@7.66.1(react@18.3.1)) @@ -123,6 +123,9 @@ importers: '@sentry/profiling-node': specifier: ^10.25.0 version: 10.26.0 + '@sentry/react': + specifier: ^10.25.0 + version: 10.26.0(react@18.3.1) '@solana/wallet-adapter-react': specifier: ^0.15.35 version: 0.15.39(@solana/web3.js@1.98.4(bufferutil@4.0.9)(typescript@5.5.4)(utf-8-validate@5.0.10))(bs58@6.0.0)(fastestsmallesttextencoderdecoder@1.0.22)(react-native@0.82.1(@babel/core@7.28.5)(@types/react@18.3.1)(bufferutil@4.0.9)(react@18.3.1)(utf-8-validate@5.0.10))(react@18.3.1)(typescript@5.5.4) @@ -6065,6 +6068,7 @@ packages: '@smithy/core@3.18.4': resolution: {integrity: sha512-o5tMqPZILBvvROfC8vC+dSVnWJl9a0u9ax1i1+Bq8515eYjUJqqk5XjjEsDLoeL5dSqGSh6WGdVx1eJ1E/Nwhw==} engines: {node: '>=18.0.0'} + deprecated: Please upgrade your lockfile to use the latest 3.x version of @smithy/core for various fixes, see https://github.com/smithy-lang/smithy-typescript/blob/main/packages/core/CHANGELOG.md '@smithy/credential-provider-imds@4.2.5': resolution: {integrity: sha512-BZwotjoZWn9+36nimwm/OLIcVe+KYRwzMjfhd4QT7QxPm9WY0HiOV8t/Wlh+HVUif0SBVV7ksq8//hPaBC/okQ==} @@ -8128,9 +8132,11 @@ packages: '@walletconnect/sign-client@2.19.0': resolution: {integrity: sha512-+GkuJzPK9SPq+RZgdKHNOvgRagxh/hhYWFHOeSiGh3DyAQofWuFTq4UrN/MPjKOYswSSBKfIa+iqKYsi4t8zLQ==} + deprecated: 'Reliability and performance improvements. See: https://github.com/WalletConnect/walletconnect-monorepo/releases' '@walletconnect/sign-client@2.19.1': resolution: {integrity: sha512-OgBHRPo423S02ceN3lAzcZ3MYb1XuLyTTkKqLmKp/icYZCyRzm3/ynqJDKndiBLJ5LTic0y07LiZilnliYqlvw==} + deprecated: 'Reliability and performance improvements. See: https://github.com/WalletConnect/walletconnect-monorepo/releases' '@walletconnect/solana-adapter@0.0.8': resolution: {integrity: sha512-Qb7MT8SdkeBldfUCmF+rYW6vL98mxPuT1yAwww5X2vpx7xEPZvFCoAKnyT5fXu0v56rMxhW3MGejnHyyYdDY7Q==} @@ -8149,9 +8155,11 @@ packages: '@walletconnect/universal-provider@2.19.0': resolution: {integrity: sha512-e9JvadT5F8QwdLmd7qBrmACq04MT7LQEe1m3X2Fzvs3DWo8dzY8QbacnJy4XSv5PCdxMWnua+2EavBk8nrI9QA==} + deprecated: 'Reliability and performance improvements. See: https://github.com/WalletConnect/walletconnect-monorepo/releases' '@walletconnect/universal-provider@2.19.1': resolution: {integrity: sha512-4rdLvJ2TGDIieNWW3sZw2MXlX65iHpTuKb5vyvUHQtjIVNLj+7X/09iUAI/poswhtspBK0ytwbH+AIT/nbGpjg==} + deprecated: 'Reliability and performance improvements. See: https://github.com/WalletConnect/walletconnect-monorepo/releases' '@walletconnect/utils@2.19.0': resolution: {integrity: sha512-LZ0D8kevknKfrfA0Sq3Hf3PpmM8oWyNfsyWwFR51t//2LBgtN2Amz5xyoDDJcjLibIbKAxpuo/i0JYAQxz+aPA==} @@ -16914,10 +16922,10 @@ snapshots: '@ag-ui/core': 0.0.41 '@ag-ui/proto': 0.0.41 - '@ag-ui/langgraph@0.0.18(@ag-ui/client@0.0.41)(@ag-ui/core@0.0.37)(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.203.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.9.1(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@5.0.10))(zod@3.25.76))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@ag-ui/langgraph@0.0.18(@ag-ui/client@0.0.41)(@ag-ui/core@0.0.41)(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.203.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.9.1(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@5.0.10))(zod@3.25.76))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@ag-ui/client': 0.0.41 - '@ag-ui/core': 0.0.37 + '@ag-ui/core': 0.0.41 '@langchain/core': 0.3.79(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.203.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.9.1(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@5.0.10))(zod@3.25.76)) '@langchain/langgraph-sdk': 0.1.10(@langchain/core@0.3.79(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.203.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.9.1(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@5.0.10))(zod@3.25.76)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) partial-json: 0.1.7 @@ -16930,12 +16938,12 @@ snapshots: - react - react-dom - '@ag-ui/mastra@0.2.0(@ag-ui/client@0.0.41)(@ag-ui/core@0.0.37)(@copilotkit/runtime@1.10.6(9c0ec131fe3ef529a831958f12b4bf78))(@mastra/core@0.20.2(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76))(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76)': + '@ag-ui/mastra@0.2.0(@ag-ui/client@0.0.41)(@ag-ui/core@0.0.41)(@copilotkit/runtime@1.10.6(6855d89fee41a5dd20a0f9576445cd9f))(@mastra/core@0.20.2(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76))(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76)': dependencies: '@ag-ui/client': 0.0.41 - '@ag-ui/core': 0.0.37 + '@ag-ui/core': 0.0.41 '@ai-sdk/ui-utils': 1.2.11(zod@3.25.76) - '@copilotkit/runtime': 1.10.6(9c0ec131fe3ef529a831958f12b4bf78) + '@copilotkit/runtime': 1.10.6(6855d89fee41a5dd20a0f9576445cd9f) '@mastra/client-js': 0.15.2(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76) '@mastra/core': 0.20.2(openapi-types@12.1.3)(react@18.3.1)(zod@3.25.76) rxjs: 7.8.1 @@ -18876,12 +18884,12 @@ snapshots: - encoding - graphql - '@copilotkit/runtime@1.10.6(9c0ec131fe3ef529a831958f12b4bf78)': + '@copilotkit/runtime@1.10.6(6855d89fee41a5dd20a0f9576445cd9f)': dependencies: '@ag-ui/client': 0.0.41 - '@ag-ui/core': 0.0.37 + '@ag-ui/core': 0.0.41 '@ag-ui/encoder': 0.0.41 - '@ag-ui/langgraph': 0.0.18(@ag-ui/client@0.0.41)(@ag-ui/core@0.0.37)(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.203.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.9.1(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@5.0.10))(zod@3.25.76))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@ag-ui/langgraph': 0.0.18(@ag-ui/client@0.0.41)(@ag-ui/core@0.0.41)(@opentelemetry/api@1.9.0)(@opentelemetry/exporter-trace-otlp-proto@0.203.0(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.2.0(@opentelemetry/api@1.9.0))(openai@6.9.1(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@5.0.10))(zod@3.25.76))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@ag-ui/proto': 0.0.41 '@anthropic-ai/sdk': 0.57.0 '@copilotkit/shared': 1.10.6 From 52e8198bf1591633bc0c0193cc8fc1f075769fff Mon Sep 17 00:00:00 2001 From: Enno Gelhaus Date: Wed, 26 Nov 2025 15:54:20 +0100 Subject: [PATCH 3/3] Add replayCanvasIntegration to Sentry client --- .../src/sentry/initialize.sentry.client.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/react-shared-libraries/src/sentry/initialize.sentry.client.ts b/libraries/react-shared-libraries/src/sentry/initialize.sentry.client.ts index db2010ac..31a49760 100644 --- a/libraries/react-shared-libraries/src/sentry/initialize.sentry.client.ts +++ b/libraries/react-shared-libraries/src/sentry/initialize.sentry.client.ts @@ -15,6 +15,7 @@ export const initializeSentryClient = (environment: string, dsn: string) => // Disable the injection of the default widget autoInject: false, }), + Sentry.replayCanvasIntegration(), ], replaysSessionSampleRate: 1.0, replaysOnErrorSampleRate: 1.0,