@sentry/core
Version:
Base implementation for all Sentry JavaScript SDKs
42 lines (41 loc) • 1.34 kB
JavaScript
import { defineIntegration } from "../integration.js";
import { enableManagedTunnel } from "../utils/tunnelDefaults.js";
import { forwardTunnelRequest } from "../utils/tunnelForward.js";
// src/integrations/serveTunnel.ts
const _serveTunnelIntegration = ((options = {}) => {
return {
name: "ServeTunnel",
setup(client) {
enableManagedTunnel(client, options, forwardTunnelRequest);
}
};
});
/**
* Lets your server forward the events of a browser SDK set up with `tunnel: true` to Sentry.
*
* With this integration on the server and `tunnel: true` in the browser `init`, the browser sends its events to your
* own server instead of Sentry, where ad-blockers can't drop them, and your server forwards them to Sentry.
*
* The server SDKs answer the tunnel requests before the app sees them. To serve them from your own code instead, set
* `intercept: false` and call `handleTunnelRequestIfMatched`.
*
* By default only envelopes for the server's own DSN are forwarded.
*
* @example
* ```js
* // Server
* Sentry.init({
* dsn: '__DSN__',
* integrations: [Sentry.serveTunnelIntegration()],
* });
*
* // Browser
* Sentry.init({
* dsn: '__DSN__',
* tunnel: true,
* });
* ```
*/
const serveTunnelIntegration = defineIntegration(_serveTunnelIntegration);
export { serveTunnelIntegration };
//# sourceMappingURL=serveTunnel.js.map