diff --git a/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/__tests__/index.test.ts b/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/__tests__/index.test.ts index 474d09c902..f1d1c36c32 100644 --- a/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/__tests__/index.test.ts +++ b/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/__tests__/index.test.ts @@ -16,7 +16,7 @@ describe('Send Events Action', () => { s3_secret: 'secret', s3_region: 'us-east-1', s3_bucket_accesspoint_alias: 'my-bucket', - fileNamePrefix: 'prefix' + fileNamePrefix: 'prefix_' } as Settings test('perform ValidateSettings call with valid payload and settings', async () => { diff --git a/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/__tests__/preCheck.test.ts b/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/__tests__/preCheck.test.ts index e81760ac04..e604e5cf56 100644 --- a/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/__tests__/preCheck.test.ts +++ b/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/__tests__/preCheck.test.ts @@ -9,7 +9,7 @@ const validS3Settings = { s3_secret: 'secret', s3_region: 'us-east-1', s3_bucket_accesspoint_alias: 'my-bucket', - fileNamePrefix: 'prefix' + fileNamePrefix: 'prefix_' } describe('validateSettings', () => { diff --git a/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/eventprocessing.ts b/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/eventprocessing.ts index 05a391c8ab..74fff53439 100644 --- a/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/eventprocessing.ts +++ b/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/eventprocessing.ts @@ -6,12 +6,7 @@ import get from 'lodash/get' export function parseSections(section: { [key: string]: string }, nestDepth: number) { const parseResults: { [key: string]: string } = {} - if (nestDepth > 10) - throw new IntegrationError( - 'Event data exceeds nesting depth. Use Mapping to flatten the data to no more than 3 levels deep', - 'NESTING_DEPTH_EXCEEDED', - 400 - ) + if (nestDepth > 10) throw new IntegrationError('Event data exceeds nesting depth.', 'NESTING_DEPTH_EXCEEDED', 400) try { if (section === null) section = { null: '' } @@ -31,11 +26,19 @@ export function parseSections(section: { [key: string]: string }, nestDepth: num } } } catch (e) { - throw new IntegrationError( - `Unexpected Exception while parsing Event payload.\n ${e}`, - 'UNEXPECTED_EVENT_PARSING_EXCEPTION', - 400 - ) + const ie = e as IntegrationError + if (ie.code === 'NESTING_DEPTH_EXCEEDED') + throw new IntegrationError( + 'Event data exceeds nesting depth. Use Mapping to flatten data structures to no more than 3 levels deep', + 'NESTING_DEPTH_EXCEEDED', + 400 + ) + else + throw new IntegrationError( + `Unexpected Exception while parsing Event payload.\n ${e}`, + 'UNEXPECTED_EVENT_PARSING_EXCEPTION', + 400 + ) } return parseResults } diff --git a/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/preCheck.ts b/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/preCheck.ts index 0f38e40e38..9248a1cce6 100644 --- a/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/preCheck.ts +++ b/packages/destination-actions/src/destinations/acoustic-s3tc/receiveEvents/preCheck.ts @@ -19,7 +19,25 @@ function validateSettings(settings: Settings) { } if (!settings.fileNamePrefix) { - throw new IntegrationError('Missing Customer Prefix', 'MISSING_CUSTOMER_PREFIX', 400) + throw new IntegrationError( + 'Missing Customer Prefix. Customer Prefix should be of the form of 4-5 characters followed by an underscore character', + 'MISSING_CUSTOMER_PREFIX', + 400 + ) + } + if (!settings.fileNamePrefix.endsWith('_')) { + throw new IntegrationError( + 'Invalid Customer Prefix. Customer Prefix must end with an underscore character "_". ', + 'INVALID_CUSTOMER_PREFIX', + 400 + ) + } + if (settings.fileNamePrefix === 'customer_org_') { + throw new IntegrationError( + 'Unedited Customer Prefix. Customer Prefix remains as the default value, must edit and provide a valid Customer prefix (4-5 characters) followed by an underscore', + 'INVALID_CUSTOMER_PREFIX', + 400 + ) } }