Skip to content

Commit

Permalink
fix: audienceId not found error
Browse files Browse the repository at this point in the history
  • Loading branch information
vyeshwanth committed Aug 22, 2024
1 parent 018bf23 commit 13c5469
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/v0/destinations/fb_custom_audience/recordTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const {
responseBuilderSimple,
getDataSource,
} = require('./util');
const logger = require('../../../logger');

const processRecordEventArray = (
recordChunksArray,
Expand Down Expand Up @@ -105,7 +104,7 @@ async function processRecordInputs(groupedRecordInputs) {
const { message } = groupedRecordInputs[0];
const { isHashRequired, accessToken, disableFormat, type, subType, isRaw, maxUserCount } =
destination.Config;
const audienceId = get(connection, 'Config.destination.audienceId');
const audienceId = get(connection, 'config.destination.audienceId');
const prepareParams = {
access_token: accessToken,
};
Expand All @@ -117,11 +116,9 @@ async function processRecordInputs(groupedRecordInputs) {
}

// audience id validation
logger.debug('Connection_object', JSON.stringify(connection));
logger.debug('Event_object', JSON.stringify(message));
let operationAudienceId = audienceId;
const mappedToDestination = get(message, MappedToDestinationKey);
if (mappedToDestination) {
if (mappedToDestination && !operationAudienceId) {
const { objectType } = getDestinationExternalIDInfoForRetl(message, 'FB_CUSTOM_AUDIENCE');
operationAudienceId = objectType;
}
Expand Down
3 changes: 1 addition & 2 deletions src/v0/destinations/fb_custom_audience/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const processEvent = (message, destination, connection) => {
let toSendEvents = [];
let { userSchema } = destination.Config;
const { isHashRequired, maxUserCount } = destination.Config;
const audienceId = get(connection, 'Config.destination.audienceId');
const audienceId = get(connection, 'config.destination.audienceId');
if (!message.type) {
throw new InstrumentationError('Message Type is not present. Aborting message.');
}
Expand Down Expand Up @@ -248,7 +248,6 @@ const processRouterDest = async (inputs, reqMetadata) => {
const eventTypes = ['record', 'audiencelist'];
const unsupportedEventList = checkForUnsupportedEventTypes(groupedInputs, eventTypes);
if (unsupportedEventList.length > 0) {
logger.info(`unsupported events found ${unsupportedEventList}`);
throw new ConfigurationError('unsupported events present in the event');
}

Expand Down

0 comments on commit 13c5469

Please sign in to comment.