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(marketo): unhandled exception status-code fix #1432

Merged
merged 10 commits into from
Sep 22, 2022
14 changes: 14 additions & 0 deletions __mocks__/data/marketo/proxy_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,19 @@
},
"https://mktId.mktorest.com/rest/v1/leads.json/test7": {
"code": "[ENOTFOUND] :: DNS lookup failed"
},
"https://unhandled_exception_in_proxy_req.mktorest.com/rest/v1/leads.json": {
"data": {
"requestId": "142e4#1835b117b76",
"success": false,
"errors": [
{
"code": "random_marketo_code",
"message": "problem"
}
]
},
"status": 200,
"statusText": "OK"
}
}
73 changes: 73 additions & 0 deletions __mocks__/data/marketo/response.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,78 @@
"message": "Any other error"
}
]
},
"https://valid_account_broken_event.mktorest.com/identity/oauth/token": {
"access_token": "access_token_success",
"expires_in": 3599,
"scope": "integrations@rudderstack.com",
"token_type": "bearer"
},
"https://valid_account_broken_event.mktorest.com/rest/v1/leads.json?filterType=email&filterValues=0c7b8b80-9c43-4f8e-b2d2-5e2448a25040@j.mail": {
"requestId": "12093#17672aeaee6",
"result": [],
"success": true
},
"https://valid_account_broken_event.mktorest.com/rest/v1/leads.json": {
"requestId": "142e4#1835b117b76",
"success": false,
"errors": [
{
"code": "1006",
"message": "Lookup field 'userId' not found"
}
]
},
"https://unhandled_status_code.mktorest.com/identity/oauth/token": {
"access_token": "access_token_success",
"expires_in": 3599,
"scope": "integrations@rudderstack.com",
"token_type": "bearer"
},
"https://unhandled_status_code.mktorest.com/rest/v1/leads.json?filterType=email&filterValues=0c7b8b80-9c43-4f8e-b2d2-5e2448a25040@j.mail": {
"requestId": "12093#17672aeaee6",
"result": [],
"success": true
},
"https://unhandled_status_code.mktorest.com/rest/v1/leads.json": {
"requestId": "142e4#1835b117b76",
"success": false,
"errors": [
{
"code": "random_marketo_code",
"message": "some other problem"
}
]
},
"https://successful_identify_transformation.mktorest.com/identity/oauth/token": {
"access_token": "access_token_success",
"expires_in": 3599,
"scope": "integrations@rudderstack.com",
"token_type": "bearer"
},
"https://successful_identify_transformation.mktorest.com/rest/v1/leads.json": {
"requestId": "7ab2#17672a46a99",
"result": [
{
"id": 4,
"status": "created"
}
],
"success": true
},
"https://successful_identify_transformation.mktorest.com/rest/v1/leads.json?filterType=email&filterValues=0c7b8b80-9c43-4f8e-b2d2-5e2448a25040@j.mail": {
"requestId": "12093#17672aeaee6",
"result": [
{
"createdAt": "2022-09-17T21:39:07Z",
"email": "0c7b8b80-9c43-4f8e-b2d2-5e2448a25040@j.mail",
"firstName": "random_first",
"id": 4,
"lastName": "random_last",
"updatedAt": "2022-09-20T21:48:07Z",
"userId": "test-user-957ue"
}
],
"success": true
}
}
34 changes: 34 additions & 0 deletions __tests__/data/marketo_proxy_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,39 @@
"files": {}
}
}
},
{
"request": {
"body": {
"version": "1",
"type": "REST",
"method": "POST",
"endpoint": "https://unhandled_exception_in_proxy_req.mktorest.com/rest/v1/leads.json",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer access_token_success"
},
"params": {},
"body": {
"JSON": {
"action": "createOrUpdate",
"input": [
{
"Email": "0c7b8b80-9c43-4f8e-b2d2-5e2448a25040@j.mail",
"FirstName": "A",
"LastName": "M",
"id": 4,
"userId": "e17c5a5e-5e2f-430b-b497-fe3f1ea3a704"
}
],
"lookupField": "id"
},
"XML": {},
"JSON_ARRAY": {},
"FORM": {}
},
"files": {}
}
}
}
]
25 changes: 25 additions & 0 deletions __tests__/data/marketo_proxy_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,30 @@
"errorAt": "proxy"
}
}
},
{
"output": {
"status": 400,
"message": "[Error occurred while processing response for destination marketo]: Error occurred during Marketo Response Handling -> problem",
"destinationResponse": {
"response": {
"requestId": "142e4#1835b117b76",
"success": false,
"errors": [
{
"code": "random_marketo_code",
"message": "problem"
}
]
},
"status": 200
},
"statTags": {
"destType": "MARKETO",
"stage": "responseTransform",
"scope": "exception",
"errorAt": "proxy"
}
}
}
]
Loading