Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bugsnag issue fix for zendesk #3439

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/v0/destinations/zendesk/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const {
NetworkInstrumentationError,
InstrumentationError,
NetworkError,
isDefinedAndNotNull,
} = require('@rudderstack/integrations-lib');
const myAxios = require('../../../util/myAxios');

Expand Down Expand Up @@ -405,6 +406,9 @@ async function getUserMembershipPayload(message, headers, orgId, destinationConf
}

async function createOrganization(message, category, headers, destinationConfig, baseEndpoint) {
if (!isDefinedAndNotNull(message.traits)) {
koladilip marked this conversation as resolved.
Show resolved Hide resolved
throw new InstrumentationError('Organisation Traits are missing. Aborting.');
}
await checkAndCreateUserFields(
message.traits,
category.organizationFieldsEndpoint,
Expand Down
85 changes: 85 additions & 0 deletions test/integrations/destinations/zendesk/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2370,4 +2370,89 @@ export const data = [
},
},
},
{
name: 'zendesk',
description: 'Group Call : If message.traits are not present, aborting the call.',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
destination: {
Config: {
apiToken: 'myDummyApiToken4',
createUsersAsVerified: true,
domain: 'rudderlabshelp',
email: 'myDummyUserName1',
password: 'myDummyPwd1',
removeUsersFromOrganization: true,
sendGroupCallsWithoutUserId: true,
},
DestinationDefinition: {
DisplayName: 'Zendesk',
ID: '1YknZ1ENqB8UurJQJE2VrEA61tr',
Name: 'ZENDESK',
},
Enabled: true,
ID: 'xxxxxxxxxxxxxxxxxxxxxxxO51P',
Name: 'zendesk',
Transformations: [],
},
message: {
anonymousId: '297b0750-934b-4411-b66c-9b418cdbc0c9',
channel: 'web',
context: {
app: {
build: '1.0.0',
name: 'RudderLabs JavaScript SDK',
namespace: 'com.rudderlabs.javascript',
version: '1.1.0-beta.2',
},
ip: '0.0.0.0',
library: { name: 'RudderLabs JavaScript SDK', version: '1.1.0-beta.2' },
locale: 'en-GB',
os: { name: '', version: '' },
screen: { density: 2 },
traits: { email: '[email protected]', name: 'abcd124' },
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36',
},
groupId: 'group-124',
integrations: { All: true },
messageId: '2d54ba80-ce5f-4bcb-b1d7-7587e7a865fc',
originalTimestamp: '2020-03-23T18:27:28.983Z',
receivedAt: '2020-03-23T23:57:29.022+05:30',
request_ip: '[::1]:51574',
sentAt: '2020-03-23T18:27:28.983Z',
timestamp: '2020-03-23T23:57:29.022+05:30',
type: 'group',
userId: 'abcd-124',
},
},
],
method: 'POST',
},
},
output: {
response: {
status: 200,
body: [
{
error: 'Organisation Traits are missing. Aborting.',
statTags: {
destType: 'ZENDESK',
errorCategory: 'dataValidation',
errorType: 'instrumentation',
feature: 'processor',
implementation: 'native',
module: 'destination',
},
statusCode: 400,
},
],
},
},
},
];
Loading