@@ -10,13 +10,23 @@ import {
1010import { DocumentBuilder , SwaggerModule } from '@nestjs/swagger' ;
1111import * as config from 'config' ;
1212import { ClsMiddleware } from 'nestjs-cls' ;
13- import { S3StreamLogger } from 's3-streamlogger' ;
13+ import { S3StreamLogger , S3StreamLoggerOptions } from 's3-streamlogger' ;
1414import { install } from 'source-map-support' ;
1515import { SPLAT } from 'triple-beam' ;
1616import * as winston from 'winston' ;
1717import { createLogger } from 'winston' ;
1818import { generateModuleGraph } from './commands/graph' ;
1919import { MainModule } from './main.module' ;
20+ import { S3ClientConfig } from '@aws-sdk/client-s3' ;
21+
22+ // S3StreamLogger passes its config to S3Client, but doesn't accept all the
23+ // properties of S3ClientConfig. This allows those properties.
24+ interface SafeS3StreamLoggerOptions extends S3StreamLoggerOptions {
25+ config : S3StreamLoggerOptions [ 'config' ] & {
26+ forcePathStyle : boolean ;
27+ endpoint : string ;
28+ } ;
29+ }
2030
2131const registerSwagger = ( app : NestFastifyApplication ) => {
2232 const documentBuilderConfig = new DocumentBuilder ( )
@@ -96,7 +106,7 @@ const registerMultiPart = async (app: NestFastifyApplication) => {
96106} ;
97107
98108function setupLogger ( ) {
99- const s3Stream = new S3StreamLogger ( {
109+ const s3StreamOptions : SafeS3StreamLoggerOptions = {
100110 rotate_every : 1000 * 60 * 60 * 24 , //1 Day
101111 folder : 'logs' ,
102112 bucket : config . get < string > ( 'STORAGE.BUCKET' ) ,
@@ -110,7 +120,9 @@ function setupLogger() {
110120 forcePathStyle : true ,
111121 endpoint : config . get ( 'STORAGE.URL' ) ,
112122 } ,
113- } ) ;
123+ } ;
124+
125+ const s3Stream = new S3StreamLogger ( s3StreamOptions ) ;
114126
115127 const timeStampFormat = winston . format . timestamp ( {
116128 format : 'YYYY-MMM-DD HH:mm:ss' ,
0 commit comments