@@ -77,21 +77,24 @@ export function init(options: AwsServerlessOptions = {}): NodeClient | undefined
7777 // 2. Environment variable SENTRY_LAYER_EXTENSION (if set)
7878 // 3. Default logic based on sdkSource, tunnel, and proxy settings
7979 const useLayerExtensionFromEnv = envToBool ( process . env . SENTRY_LAYER_EXTENSION , { strict : true } ) ;
80- const defaultUseLayerExtension =
81- sdkSource === 'aws-lambda-layer' && typeof options . tunnel !== 'string' && ! proxyWouldInterfere ;
80+ // A relative path is the managed tunnel's path, not a transport URL.
81+ const { tunnel, _managedTunnel } = resolveServerTunnelOption ( options . tunnel ) ;
82+ const defaultUseLayerExtension = sdkSource === 'aws-lambda-layer' && ! tunnel && ! proxyWouldInterfere ;
8283 const useLayerExtension = options . useLayerExtension ?? useLayerExtensionFromEnv ?? defaultUseLayerExtension ;
8384
8485 const opts = {
8586 defaultIntegrations : getDefaultIntegrations ( options ) ,
8687 useLayerExtension,
8788 ...options ,
89+ tunnel,
90+ _managedTunnel,
8891 } ;
8992
9093 if ( opts . useLayerExtension ) {
9194 if ( sdkSource !== 'aws-lambda-layer' ) {
9295 DEBUG_BUILD && debug . warn ( 'The Sentry Lambda extension is only supported when using the AWS Lambda layer.' ) ;
93- } else if ( typeof opts . tunnel === 'string' || proxyWouldInterfere ) {
94- if ( typeof opts . tunnel === 'string' ) {
96+ } else if ( opts . tunnel || proxyWouldInterfere ) {
97+ if ( opts . tunnel ) {
9598 DEBUG_BUILD &&
9699 debug . warn (
97100 `Using a custom tunnel with the Sentry Lambda extension is not supported. Events will be tunnelled to ${ opts . tunnel } and not through the extension.` ,
@@ -106,8 +109,6 @@ export function init(options: AwsServerlessOptions = {}): NodeClient | undefined
106109 }
107110 } else {
108111 DEBUG_BUILD && debug . log ( 'Proxying Sentry events through the Sentry Lambda extension' ) ;
109- // The extension takes over the transport, but the managed tunnel is still served.
110- opts . _managedTunnel = resolveServerTunnelOption ( opts . tunnel ) . _managedTunnel ;
111112 opts . tunnel = 'http://localhost:9000/envelope' ;
112113 }
113114 }
0 commit comments