How to troubleshoot Custom Synapse Issues

Rok Kovač
Rok Kovač
  • Updated

Syncari provides out of the box error message viewing in the Synapse studio - for any credential related issues, on the pipelines themselves - for issues related to those specific entities and in the SyncError section of logs. You can read more about it in our support article here: https://support.syncari.com/hc/en-us/articles/22941627282708-Pipeline-Errors-and-Warnings.

Adding Logging to the Synapse

For additional context during troubleshooting, you can leverage our error logger that comes with syncari.rest.client. To add logging simply insert logger.error(“message”) into the except block and once it executes the logs will be added to the file.

For example you can wrap the REST request in the read method in a try/except block and in the except block add logging information that not only includes the end system error information but also the sync_request object, to ease troubleshooting.

try:
    resp = self.client.get(f"sync_request.entity.pluralName?updated_after={start}&updated_before={end}offset={offset}")
except SyncariException as e:
    error_response = e.error_response.json()
    status_code = e.error_response.status_code
    # adding logger
    logger.error(f"ERROR. Status code: {status_code}, Error: {error_response}, Sync Request: {sync_request}")
    raise SyncariException(ErrorResponse(status_code=status_code,message=f"{error_response}"))

Similarly the CRUD methods can have the logging added on except blocks to include the payload that was sent for a single record or the whole set in bulk request cases.

try:
    resp = self.client.post(f'{entity_name}/{record.id}', json=record.values)
    record = resp.json()
    results.append(Result(id=record.get('id'), syncariId=record.syncariEntityId))
except SyncariException as e:
    # adding logger
    error_response = e.error_response.json()
    status_code = e.error_response.status_code
    logger.error(f"ERROR. Status code: {status_code}, Error: {error_response}, Sync Request: {sync_request}")
    results.append(Result(id=record.get(f'Entity: {self.sync_request.entity.apiName}. Record: {record}. Status Code: {status_code}. Error: {error_response}'), syncariId=record.syncariEntityId, success=False, errors=[error_response]))

Accessing Error Logs in Syncari

To access the Synapse logs you need to have Instance Admin permissions. Navigate to the Custom Synapse menu in the Synapse Studio and click on the kebab menu of the synapse you wish to download logs from. In the menu you would select the “Download error logs” option.

 

 

Share this

Was this article helpful?

0 out of 0 found this helpful