Skip to content

Commit

Permalink
fix: amplitude batch output metadata (#3077)
Browse files Browse the repository at this point in the history
* fix: amplitude batching

* refactor: remove commented code

* refactor: remove redundant import
  • Loading branch information
Gauravudia authored Feb 12, 2024
1 parent de3518f commit 69c8348
Show file tree
Hide file tree
Showing 3 changed files with 369 additions and 179 deletions.
13 changes: 3 additions & 10 deletions src/v0/destinations/am/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const {
getFieldValueFromMessage,
getValueFromMessage,
deleteObjectProperty,
getErrorRespEvents,
removeUndefinedAndNullValues,
isDefinedAndNotNull,
isAppleFamily,
isDefinedAndNotNullAndNotEmpty,
simpleProcessRouterDest,
isValidInteger,
handleRtTfSingleEventError,
} = require('../../util');
const {
BASE_URL,
Expand All @@ -40,7 +40,6 @@ const {
AMBatchSizeLimit,
AMBatchEventLimit,
} = require('./config');
const tags = require('../../util/tags');

const AMUtils = require('./utils');

Expand Down Expand Up @@ -904,16 +903,10 @@ const batch = (destEvents) => {
// this case shold not happen and should be filtered already
// by the first pass of single event transformation
if (messageEvent && !userId && !deviceId) {
const errorResponse = getErrorRespEvents(
metadata,
400,
const MissingUserIdDeviceIdError = new InstrumentationError(
'Both userId and deviceId cannot be undefined',
{
[tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.DATA_VALIDATION,
[tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.INSTRUMENTATION,
},
);
respList.push(errorResponse);
respList.push(handleRtTfSingleEventError(ev, MissingUserIdDeviceIdError, {}));
return;
}
/* check if not a JSON body or (userId length < 5 && batchEventsWithUserIdLengthLowerThanFive is false) or
Expand Down
Loading

0 comments on commit 69c8348

Please sign in to comment.