@@ -1298,7 +1298,7 @@ class ApiGateway {
12981298 this . log ( {
12991299 type : 'Query Rewrite completed' ,
13001300 queryRewriteId,
1301- normalizedQueries,
1301+ normalizedQueries : normalizedQueries . map ( q => this . sanitizeQueryForLogging ( q ) ) ,
13021302 duration : Date . now ( ) - startTime ,
13031303 query
13041304 } , context ) ;
@@ -1631,7 +1631,7 @@ class ApiGateway {
16311631 this . log ( {
16321632 type : 'Load Request SQL' ,
16331633 duration : this . duration ( loadRequestSQLStarted ) ,
1634- query : normalizedQueries [ index ] ,
1634+ query : this . sanitizeQueryForLogging ( normalizedQueries [ index ] ) ,
16351635 sqlQuery
16361636 } , context ) ;
16371637
@@ -1642,6 +1642,12 @@ class ApiGateway {
16421642 return sqlQueries ;
16431643 }
16441644
1645+ private sanitizeQueryForLogging ( query : NormalizedQuery ) : NormalizedQuery {
1646+ const res : NormalizedQuery = { ...query } ;
1647+ delete res . cacheMode ;
1648+ return res ;
1649+ }
1650+
16451651 /**
16461652 * Execute query and return adapter's result.
16471653 * @internal
@@ -2170,7 +2176,7 @@ class ApiGateway {
21702176
21712177 public async contextByReq ( req : Request , securityContext , requestId : string ) : Promise < ExtendedRequestContext > {
21722178 req . securityContext = securityContext ;
2173-
2179+
21742180 const extensions = typeof this . extendContext === 'function' ? await this . extendContext ( req ) : { } ;
21752181
21762182 return {
@@ -2205,31 +2211,31 @@ class ApiGateway {
22052211 if ( e instanceof CubejsHandlerError ) {
22062212 this . log ( {
22072213 type : e . type ,
2208- query,
2214+ query : this . sanitizeQueryForLogging ( query ) ,
22092215 error : e . message ,
22102216 duration : this . duration ( requestStarted )
22112217 } , context ) ;
22122218 res ( { error : e . message , stack, requestId, plainError } , { status : e . status } ) ;
22132219 } else if ( e . error === 'Continue wait' ) {
22142220 this . log ( {
22152221 type : 'Continue wait' ,
2216- query,
2222+ query : this . sanitizeQueryForLogging ( query ) ,
22172223 error : e . message ,
22182224 duration : this . duration ( requestStarted ) ,
22192225 } , context ) ;
22202226 res ( { error : e . message || e . error . message || e . error . toString ( ) , requestId } , { status : 200 } ) ;
22212227 } else if ( e . error ) {
22222228 this . log ( {
22232229 type : 'Orchestrator error' ,
2224- query,
2230+ query : this . sanitizeQueryForLogging ( query ) ,
22252231 error : e . error ,
22262232 duration : this . duration ( requestStarted ) ,
22272233 } , context ) ;
22282234 res ( { error : e . message || e . error . message || e . error . toString ( ) , requestId } , { status : 400 } ) ;
22292235 } else if ( e . type === 'UserError' ) {
22302236 this . log ( {
22312237 type : e . type ,
2232- query,
2238+ query : this . sanitizeQueryForLogging ( query ) ,
22332239 error : e . message ,
22342240 duration : this . duration ( requestStarted )
22352241 } , context ) ;
0 commit comments