File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
packages/cubejs-api-gateway Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -2146,11 +2146,6 @@ class ApiGateway {
21462146 req . securityContext = await checkAuthFn ( auth , secret ) ;
21472147 req . signedWithPlaygroundAuthSecret = Boolean ( internalOptions ?. isPlaygroundCheckAuth ) ;
21482148 } catch ( e ) {
2149- this . log ( {
2150- type : ( e as Error ) . message ,
2151- token : auth ,
2152- error : ( e as Error ) . stack || ( e as Error ) . toString ( )
2153- } , < any > req ) ;
21542149 if ( this . enforceSecurityChecks ) {
21552150 throw new CubejsHandlerError ( 403 , 'Forbidden' , 'Invalid token' ) ;
21562151 }
@@ -2272,6 +2267,13 @@ class ApiGateway {
22722267 }
22732268 } catch ( e : unknown ) {
22742269 if ( e instanceof CubejsHandlerError ) {
2270+ this . log ( {
2271+ type : ( e as Error ) . message ,
2272+ url : req . url ,
2273+ token,
2274+ error : ( e as Error ) . stack || ( e as Error ) . toString ( )
2275+ } , < any > req ) ;
2276+
22752277 res . status ( e . status ) . json ( { error : e . message } ) ;
22762278 } else if ( e instanceof Error ) {
22772279 this . log ( {
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ describe('test authorization', () => {
129129 . set ( 'Authorization' , `Authorization: ${ badToken } ` )
130130 . expect ( 403 ) ;
131131
132- expect ( loggerMock . mock . calls . length ) . toEqual ( 3 ) ;
132+ expect ( loggerMock . mock . calls . length ) . toEqual ( 1 ) ;
133133 expect ( handlerMock . mock . calls . length ) . toEqual ( 2 ) ;
134134
135135 expectSecurityContext ( handlerMock . mock . calls [ 0 ] [ 0 ] . context . securityContext ) ;
You can’t perform that action at this time.
0 commit comments