File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,12 +18,13 @@ jest.mock("aws-embedded-metrics", () => {
1818
1919 return {
2020 metricScope : jest . fn (
21- ( handler : ( metrics : typeof metricsMock ) => unknown ) : void => {
22- const wrapped = handler ( metricsMock ) ;
23- if ( typeof wrapped === "function" ) {
24- wrapped ( ) ;
25- }
26- } ,
21+ ( handler ) =>
22+ async ( ) => {
23+ const wrapped = handler ( metricsMock ) ;
24+ if ( typeof wrapped === "function" ) {
25+ await wrapped ( ) ;
26+ }
27+ } ,
2728 ) ,
2829 __metricsMock : metricsMock ,
2930 } ;
Original file line number Diff line number Diff line change @@ -120,12 +120,12 @@ async function checkCertificateExpiry(
120120 const expiry = getCertificateExpiryInDays ( certificate ) ;
121121
122122 if ( expiry <= deps . env . CLIENT_CERTIFICATE_EXPIRATION_ALERT_DAYS ) {
123- metricScope ( ( metrics : MetricsLogger ) => async ( ) => {
123+ await metricScope ( ( metrics : MetricsLogger ) => async ( ) => {
124124 deps . logger . warn ( `APIM Certificated expiry in ${ expiry } days` ) ;
125125 metrics . setNamespace (
126- process . env . AWS_LAMBDA_FUNCTION_NAME || "authorizer" ,
126+ process . env . AWS_LAMBDA_FUNCTION_NAME || "authorizer" ,
127127 ) ;
128128 metrics . putMetric ( "apim-client-certificate-near-expiry" , expiry , "Count" ) ;
129- } ) ;
129+ } ) ( ) ;
130130 }
131131}
You can’t perform that action at this time.
0 commit comments