Troubleshooting Issues in Sugar

Do you have an error and are feeling lost in the vast world of APIs and Sugar? Hopefully this article will provide some much needed context and direction.

Whenever you are troubleshooting, you want to minimize the variables to isolate the issue.

Think of Sugar as a layer on top of any original endpoints APIs. Likewise, any additional features you use on Sugar such as procedures, transformations or bulk, add additional layers of functionality. More layers means more variables.

The goal of troubleshooting Sugar is to tear off layer by layer of functionality until you find where the issue is.

Case Study

Let's say you have a procedure, and it is failing. Lets go through the steps in a hypothetical situation:

Step 1. Review procedure execution logs

Because we're troubleshooting a procedure, let's start by looking at the procedure execution logs to determine what step is failing.

You find it was failing on a Adapter Request Step. Now you know that it's an API call that's failing. Let's remove the "layer" of procedures. From the execution log, you can see that the request is: POST /MyCustomObject. The request is using a common resource with a transformation, that's another layer.

Step 2. Test outside of the procedure

Get the payload that was being sent in the procedure from the execution logs and test the API outside of the procedure. When you call POST /MyCustomObject, you see that its failing with a 500 Internal Server Error. Perfect.

Step 3. Check the adapter instance

Let's make sure the adapter instance is working. You call another API on that adapter instance without using your transformation and it works fine. 

Let's say your transformation is mapped to contacts. Try transforming the data yourself and create a contact with the same data. You discover that works. So the transformation is the problem.

Step 4. Check your transformation

Call GET /MyCustomObject to see what the data looks like when you retrieve it. You find it looks weird. firstName is mapped to a date field. The problem is on the transformation.


This same strategy should be used with any "layer" on Sugar, like events, bulk, Adapter Builder. Remember that each feature you use adds another "layer" on top of the original API, whatever it may be. When debugging, remove as many layers as possible to get to the root of the issue.