diff --git a/src/controllers/bulkUpload.ts b/src/controllers/bulkUpload.ts index 85c4fe6b4f..babb8b6db1 100644 --- a/src/controllers/bulkUpload.ts +++ b/src/controllers/bulkUpload.ts @@ -1,7 +1,7 @@ /* eslint-disable global-require, import/no-dynamic-require, @typescript-eslint/no-unused-vars */ import { client as errNotificationClient } from '../util/errorNotifier'; import logger from '../logger'; -import { CatchErr } from '../util/types'; +import { CatchErr, ContextBodySimple } from '../util/types'; // TODO: To be refactored and redisgned const getDestFileUploadHandler = (version, dest) => @@ -45,7 +45,7 @@ export const fileUpload = async (ctx) => { return {}; }; - const { destType } = ctx.request.body; + const { destType }: ContextBodySimple = ctx.request.body; const destFileUploadHandler = getDestFileUploadHandler('v0', destType.toLowerCase()); if (!destFileUploadHandler || !destFileUploadHandler.processFileData) { @@ -82,7 +82,7 @@ export const pollStatus = async (ctx) => { JSON.stringify(ctx.request.body), ); - const { destType } = ctx.request.body; + const { destType }: ContextBodySimple = ctx.request.body; const destFileUploadHandler = getPollStatusHandler('v0', destType.toLowerCase()); let response; if (!destFileUploadHandler || !destFileUploadHandler.processPolling) { @@ -117,7 +117,7 @@ export const getWarnJobStatus = async (ctx) => { JSON.stringify(ctx.request.body), ); - const { destType } = ctx.request.body; + const { destType }: ContextBodySimple = ctx.request.body; const destFileUploadHandler = getJobStatusHandler('v0', destType.toLowerCase()); if (!destFileUploadHandler || !destFileUploadHandler.processJobStatus) { @@ -153,7 +153,7 @@ export const getFailedJobStatus = async (ctx) => { JSON.stringify(ctx.request.body), ); - const { destType } = ctx.request.body; + const { destType }: ContextBodySimple = ctx.request.body; const destFileUploadHandler = getJobStatusHandler('v0', destType.toLowerCase()); if (!destFileUploadHandler || !destFileUploadHandler.processJobStatus) { diff --git a/src/util/types.ts b/src/util/types.ts index 579c35579c..bd2836d710 100644 --- a/src/util/types.ts +++ b/src/util/types.ts @@ -3,6 +3,9 @@ export type FixMe = any; export type CatchErr = any; +export type ContextBodySimple = { + destType: string; +}; export interface Config { cdkEnabled?: boolean; cdkV2Enabled?: boolean; diff --git a/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js b/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js index a87a2431f2..cd891d9688 100644 --- a/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js +++ b/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js @@ -190,9 +190,11 @@ const ProxyRequest = async (request) => { const addPayload = body.JSON.addConversionPayload; // Mapping Conversion Action const conversionId = await getConversionActionId(headers, params); - addPayload.operations.forEach((operation) => { - set(operation, 'create.transaction_attribute.conversion_action', conversionId); - }); + if (Array.isArray(addPayload.operations)) { + addPayload.operations.forEach((operation) => { + set(operation, 'create.transaction_attribute.conversion_action', conversionId); + }); + } await addConversionToJob(endpoint, headers, firstResponse, addPayload); const thirdResponse = await runTheJob( endpoint,