You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sentry.init({dsn: config.SENTRY_DSNasstring,integrations: [Sentry.browserTracingIntegration(),Sentry.replayIntegration({minReplayDuration: 1000,networkDetailAllowUrls: [config.API_URLasstring,],networkCaptureBodies: true,maskAllText: false,maskAllInputs: false,blockAllMedia: false,}),// The following is all you need to enable canvas recording with ReplaySentry.replayCanvasIntegration({enableManualSnapshot: true,}),],// adjust in case of too many samplestracesSampleRate: 0.2,// This sets the sample rate to be 0%. You may want this to be 100% while// in development and sample at a lower rate in productionreplaysSessionSampleRate: 0,// If the entire session is not sampled, use the below sample rate to sample// sessions when an error occurs.replaysOnErrorSampleRate: 1.0,});
Steps to Reproduce
I use modified code snippet from documentation, step 2:
exportconstsendCanvasSnapshotToSentry=(canvasEl: HTMLCanvasElement)=>{constsentryClient=Sentry.getClient();if(!sentryClient){return;}constreplayCanvasIntegration=sentryClient.getIntegrationByName('ReplayCanvas');if(!replayCanvasIntegration){return;}replayCanvasIntegration.snapshot(canvasEl);// replayCanvasIntegration has interface "Integration"};
typescript@5.3.3
Expected Result
Sentry provides interface like ReplayCanvasIntegration which extends interface Integration and defines methods of integrations (I guess the same as _replayCanvasIntegration from @sentry-internal/replay-canvas/types/canvas.d.ts). Then I'll be able to use it as a generic type like:
`snapshot` is a public API.
I think the other methods we do not need to expose (?).
With this, usage will be:
```ts
const canvas = getClient()?.getIntegrationByName<ReturnType<typeof replayCanvasIntegration>>('ReplayCanvas');
await canvas.snapshot();
```
Closes#11971
`snapshot` is a public API.
I think the other methods we do not need to expose (?).
With this, usage will be:
```ts
const canvas = getClient()?.getIntegrationByName<ReturnType<typeof replayCanvasIntegration>>('ReplayCanvas');
await canvas.snapshot();
```
Closes#11971
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/react
SDK Version
7.114.0
Framework Version
7.114.0
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
I use modified code snippet from documentation, step 2:
typescript@5.3.3
Expected Result
Sentry provides interface like
ReplayCanvasIntegration
which extends interfaceIntegration
and defines methods of integrations (I guess the same as_replayCanvasIntegration
from @sentry-internal/replay-canvas/types/canvas.d.ts). Then I'll be able to use it as a generic type like:Actual Result
Method
snapshot
is not defined in replay canvas integration, can't use it in a type safe way.The text was updated successfully, but these errors were encountered: