You are experiencing issues with your cloud function but the logs provided by Fivetran doesn’t indicate where the root cause lies.
Make sure that you are printing out errors throughout your function, specifically at points where you receive data in response or transform that data in some way (such as parsing or deserializing JSON).
When Fivetran interacts with a cloud function, the cloud platform makes a request to invoke the function (in the form of a request object) and waits for a response back (in the form of a response object).
You may experience one of the following three groups of errors:
- 4xx errors
- 5xx errors
- Non-4xx or 5xx errors
The errors indicate different root causes:
4xx errors indicate the following:
- A permissions error
- An issue with the configured JSON in the
Non-4xx or 5xx errors indicate an issue with Fivetran.
To fix the errors, do one of the following:
- Fix the permissions in the cloud function platform
- Fix the function’s configuration in the connector setup form
Non-4xx or 5xx errors
For 5xx errors, we add a Task alert ‘Fix Cloud Function’ on the connector dashboard. The notification contains the payload that caused the connector to break.
However, note that the rectification steps for 5xx errors are not straightforward; Fivetran has successfully invoked the function, but it hasn’t been completed for an unknown reason, and the error occured during the function execution.
If you have added logging throughout your function, you can do the following:
- Run your function within the cloud environment.
- Use your logging to identify and fix the line(s) of code.
- Re-run the cloud function connector.
If your cloud function incurs a 5xx error, the data sync stops until you fix the function.
You can fix and re-deploy the function within your cloud platform. You don’t need to pause your connector. If you have built idempotency into your function, Fivetran resumes the sync from where it stopped because of the connector error.