diff --git a/package-lock.json b/package-lock.json index 1b0c588272..7ef20b9928 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "FormSG", - "version": "4.30.1", + "version": "4.30.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c9801e17c5..1446f6941e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "FormSG", "description": "Form Manager for Government", - "version": "4.30.1", + "version": "4.30.2", "homepage": "https://form.gov.sg", "authors": [ "FormSG " diff --git a/src/config/config.ts b/src/config/config.ts index b7d414c776..180b998b6c 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -332,11 +332,12 @@ const awsConfig: AwsConfig = (function () { // Else, the environment variables to instantiate S3 are used. const awsEndpoint = isDev ? defaults.aws.endpoint - : `https://s3.${region}.amazonaws.com/` + : `https://s3.${region}.amazonaws.com` // NOTE NO TRAILING / AT THE END OF THIS URL! const logoBucketUrl = `${awsEndpoint}/${logoS3Bucket}` const imageBucketUrl = `${awsEndpoint}/${imageS3Bucket}` - const attachmentBucketUrl = `${awsEndpoint}/${attachmentS3Bucket}` + // NOTE THE TRAILING / AT THE END OF THIS URL! This is only for attachments! + const attachmentBucketUrl = `${awsEndpoint}/${attachmentS3Bucket}/` const s3 = new aws.S3({ region, diff --git a/src/config/logger.ts b/src/config/logger.ts index b778ea6170..1c53009e17 100644 --- a/src/config/logger.ts +++ b/src/config/logger.ts @@ -6,11 +6,13 @@ import { v4 as uuidv4 } from 'uuid' import { format, LoggerOptions, loggers, transports } from 'winston' import WinstonCloudWatch from 'winston-cloudwatch' -import { aws, customCloudWatchGroup } from './config' +import defaults from './defaults' -// Cannot use config's isDev due to logger being instantiated first, and +// Cannot use config due to logger being instantiated first, and // having circular dependencies. const isDev = process.env.NODE_ENV === 'development' +const customCloudWatchGroup = process.env.CUSTOM_CLOUDWATCH_LOG_GROUP +const awsRegion = process.env.AWS_REGION || defaults.aws.region // Config to make winston logging like console logging, allowing multiple // arguments. @@ -121,7 +123,7 @@ export const createCloudWatchLogger = (label: string) => { // not share sequence tokens. Hence generate a unique ID for each instance // of the logger. logStreamName: uuidv4(), - awsRegion: aws.region, + awsRegion, jsonMessage: true, }), ]