@@ -260,8 +260,9 @@ class ApiGateway {
260
260
const jsonQuery = getJsonQueryFromGraphQLQuery ( query , metaConfig , variables ) ;
261
261
res . json ( { jsonQuery } ) ;
262
262
} catch ( e : any ) {
263
+ const stack = getEnv ( 'devMode' ) ? e . stack : undefined ;
263
264
this . logger ( 'GraphQL to JSON error' , {
264
- error : ( e . stack || e ) . toString ( ) ,
265
+ error : ( stack || e ) . toString ( ) ,
265
266
} ) ;
266
267
res . json ( { jsonQuery : null } ) ;
267
268
}
@@ -2180,6 +2181,7 @@ class ApiGateway {
2180
2181
e, context, query, res, requestStarted
2181
2182
} : HandleErrorOptions ) {
2182
2183
const requestId = getEnv ( 'devMode' ) || context ?. signedWithPlaygroundAuthSecret ? context ?. requestId : undefined ;
2184
+ const stack = getEnv ( 'devMode' ) ? e . stack : undefined ;
2183
2185
2184
2186
const plainError = e . plainMessages ;
2185
2187
@@ -2190,7 +2192,7 @@ class ApiGateway {
2190
2192
error : e . message ,
2191
2193
duration : this . duration ( requestStarted )
2192
2194
} , context ) ;
2193
- res ( { error : e . message , stack : e . stack , requestId, plainError } , { status : e . status } ) ;
2195
+ res ( { error : e . message , stack, requestId, plainError } , { status : e . status } ) ;
2194
2196
} else if ( e . error === 'Continue wait' ) {
2195
2197
this . log ( {
2196
2198
type : 'Continue wait' ,
@@ -2219,7 +2221,7 @@ class ApiGateway {
2219
2221
type : e . type ,
2220
2222
error : e . message ,
2221
2223
plainError,
2222
- stack : e . stack ,
2224
+ stack,
2223
2225
requestId
2224
2226
} ,
2225
2227
{ status : 400 }
@@ -2228,10 +2230,10 @@ class ApiGateway {
2228
2230
this . log ( {
2229
2231
type : 'Internal Server Error' ,
2230
2232
query,
2231
- error : e . stack || e . toString ( ) ,
2233
+ error : stack || e . toString ( ) ,
2232
2234
duration : this . duration ( requestStarted )
2233
2235
} , context ) ;
2234
- res ( { error : e . toString ( ) , stack : e . stack , requestId, plainError, } , { status : 500 } ) ;
2236
+ res ( { error : e . toString ( ) , stack, requestId, plainError, } , { status : 500 } ) ;
2235
2237
}
2236
2238
}
2237
2239
@@ -2497,24 +2499,26 @@ class ApiGateway {
2497
2499
} catch ( e : unknown ) {
2498
2500
if ( e instanceof CubejsHandlerError ) {
2499
2501
const error = e . originalError || e ;
2502
+ const stack = getEnv ( 'devMode' ) ? error . stack : undefined ;
2500
2503
this . log ( {
2501
2504
type : error . message ,
2502
2505
url : req . url ,
2503
2506
token,
2504
- error : error . stack || error . toString ( )
2507
+ error : stack || error . toString ( )
2505
2508
} , < any > req ) ;
2506
2509
2507
2510
res . status ( e . status ) . json ( { error : e . message } ) ;
2508
2511
} else if ( e instanceof Error ) {
2512
+ const stack = getEnv ( 'devMode' ) ? e . stack : undefined ;
2509
2513
this . log ( {
2510
2514
type : 'Auth Error' ,
2511
2515
token,
2512
- error : e . stack || e . toString ( )
2516
+ error : stack || e . toString ( )
2513
2517
} , < any > req ) ;
2514
2518
2515
2519
res . status ( 500 ) . json ( {
2516
2520
error : e . toString ( ) ,
2517
- stack : e . stack
2521
+ stack,
2518
2522
} ) ;
2519
2523
}
2520
2524
}
@@ -2644,10 +2648,11 @@ class ApiGateway {
2644
2648
} ;
2645
2649
2646
2650
private logProbeError ( e : any , type : string ) : void {
2651
+ const stack = getEnv ( 'devMode' ) ? ( e as Error ) . stack : undefined ;
2647
2652
this . log ( {
2648
2653
type,
2649
2654
driverType : e . driverType ,
2650
- error : ( e as Error ) . stack || ( e as Error ) . toString ( ) ,
2655
+ error : stack || ( e as Error ) . toString ( ) ,
2651
2656
} ) ;
2652
2657
}
2653
2658
0 commit comments