1- import type { Client , Integration } from '@sentry/types' ;
1+ import type { Client , Envelope , Integration } from '@sentry/types' ;
22import { logger , serializeEnvelope } from '@sentry/utils' ;
33import * as http from 'http' ;
44import { URL } from 'url' ;
55
66type SpotlightConnectionOptions = {
77 /**
88 * Set this if the Spotlight Sidecar is not running on localhost:8969
9- * By default, the Url is set to http://localhost:8969
9+ * By default, the Url is set to http://localhost:8969/stream
1010 */
1111 sidecarUrl ?: string ;
1212} ;
@@ -26,7 +26,7 @@ export class Spotlight implements Integration {
2626
2727 public constructor ( options ?: SpotlightConnectionOptions ) {
2828 this . _options = {
29- sidecarUrl : options ?. sidecarUrl || 'http://localhost:8969' ,
29+ sidecarUrl : options ?. sidecarUrl || 'http://localhost:8969/stream ' ,
3030 } ;
3131 }
3232
@@ -61,7 +61,7 @@ function connectToSpotlight(client: Client, options: Required<SpotlightConnectio
6161 return ;
6262 }
6363
64- client . on ( 'beforeEnvelope' , envelope => {
64+ client . on ( 'beforeEnvelope' , ( envelope : Envelope ) => {
6565 if ( failedRequests > 3 ) {
6666 logger . warn ( '[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests' ) ;
6767 return ;
@@ -72,7 +72,7 @@ function connectToSpotlight(client: Client, options: Required<SpotlightConnectio
7272 const req = http . request (
7373 {
7474 method : 'POST' ,
75- path : '/stream' ,
75+ path : spotlightUrl . pathname ,
7676 hostname : spotlightUrl . hostname ,
7777 port : spotlightUrl . port ,
7878 headers : {
@@ -102,7 +102,7 @@ function connectToSpotlight(client: Client, options: Required<SpotlightConnectio
102102
103103function parseSidecarUrl ( url : string ) : URL | undefined {
104104 try {
105- return new URL ( `${ url } /stream ` ) ;
105+ return new URL ( `${ url } ` ) ;
106106 } catch {
107107 logger . warn ( `[Spotlight] Invalid sidecar URL: ${ url } ` ) ;
108108 return undefined ;
0 commit comments