Skip to content

Commit

Permalink
fix(bugsnag): reddit response coming as a non-string
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed Aug 28, 2024
1 parent 4cb2799 commit 7cb7162
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/v0/destinations/reddit/networkHandler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { RetryableError } = require('@rudderstack/integrations-lib');
const isString = require('lodash/isString');
const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network');
const { isHttpStatusSuccess } = require('../../util/index');
const { REFRESH_TOKEN } = require('../../../adapters/networkhandler/authConstants');
Expand All @@ -9,7 +10,7 @@ const redditRespHandler = (destResponse) => {
const { status, response } = destResponse;

// to handle the case when authorization-token is invalid
if (status === 401 && response.includes('Authorization Required')) {
if (status === 401 && isString(response) && response.includes('Authorization Required')) {
throw new RetryableError(
`Request failed due to ${response} 'during reddit response transformation'`,
500,
Expand Down

0 comments on commit 7cb7162

Please sign in to comment.