Skip to content

Commit

Permalink
fix: fixed 500 for algolia dontBatch
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishmalik committed Mar 12, 2024
1 parent 916aaec commit 70959f5
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions src/v1/destinations/algolia/networkHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,19 @@ const responseHandler = (responseParams) => {

// in case of non 2xx status sending 500 for every event, populate response and update dontBatch to true
const errorMessage = response?.error?.message || response?.message || 'unknown error format';
let serverStatus = 400;
for (const metadata of rudderJobMetadata) {
// handling case if dontBatch is true, and again we got invalid from destination
if (metadata.dontBatch && status === 422) {
responseWithIndividualEvents.push({
statusCode: 400,
metadata,
error: errorMessage,
});
} else {
serverStatus = 500;
metadata.dontBatch = true;
responseWithIndividualEvents.push({
statusCode: 500,
metadata,
error: errorMessage,
});
}
metadata.dontBatch = true;
responseWithIndividualEvents.push({

Check warning on line 46 in src/v1/destinations/algolia/networkHandler.js

View check run for this annotation

Codecov / codecov/patch

src/v1/destinations/algolia/networkHandler.js#L45-L46

Added lines #L45 - L46 were not covered by tests
statusCode: 500,
metadata,
error: errorMessage,
});
}

// sending back 500 for retry
throw new TransformerProxyError(
`ALGOLIA: Error transformer proxy v1 during ALGOLIA response transformation`,
serverStatus,
500,
{
[tags.TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(status),
},
Expand Down

0 comments on commit 70959f5

Please sign in to comment.