How to Fix Common WooCommerce Server Errors When Importing Data to Clerk.io

See how to get Data Sync running if your server returns an error

Note: We advice you to always update the plugin to the latest version in order to get all up to date features from Clerk.

When importing data with Clerk.io’s WooCommerce plugin, the webshops server is responsible for sending the product- category- and sales-data to Clerk.io.

However in some cases, the servers configuration might stop the import from getting access, causing an error in Data Sync.

Below is a list of the most common errors and how to fix them.

401 Server Error: Unauthorized

This error happens if your webshop/dev environment requires HTTP authentication to access it.

This is solved simply by inserting the Username and Password as part of the Import URL:

http://username:password@woocommerce.clerk.io

403 Server Error: Forbidden

This error happens if your server blocks the importer from accessing it. In most cases you simply need to whitelist the importers IP address to give it access.

The latest IP address can be found here.

Also check your public key, private key and import url are correct for the store you are operating within my.clerk.io

What if I have already whitelisted but the same error still occurs?

There are a few instances when you have whitelisted the importer’s IP address, and the error still persists, then we recommend you look into these parts:

  • The authentication part of the body may be removed from the request from the shop’s server.

  • Rate limit for the server in regards to cloudflares.

404 Server Error: Not Found

This error happens if the importer could not access the link that sends us data from the webshop. In most cases it happens because the plugin is either:

  • Not installed at all

  • Deactivated due to an update

  • A cache causes the link to not be initialised

  • WooCommerce permalinks are set to Post name instead of Month and name

First make sure that you have installed the plugin correctly and that it is activated.

If you recently auto-updated the plugin, WooCommerce sometimes deactivates the plugin. If this has happened, simply go to Plugins > Clerk and click Activate to get it back again.

Second, be sure to empty your webshops cache before trying a new import.

If it still doesn’t sync properly, go to Settings => Permalinks and change the Common Settings to Month and name and press Save:

429 Server Error: Too Many Requests

This error happens if your server denies the importer access because of too many incoming requests.

You can fix this by setting the request limit higher, for your server or by setting Page Size to a higher value in the Clerk.io importer, causing the importer to make fewer, bigger requests:

If you are using the host provider Byte.nl, the importer usually returns this error because of their rate limiter. In this case, simply contact Byte.nl and ask them to whitelist the importers User-Agent " clerk".

500 Internal Server Error

This error means that your server encountered an internal error and was unable to specify which error happened.

In these cases you can check your Server Log to identify which process crashed and why. In most cases it’s simply because of a product with an invalid attribute, or a function that is called wrongly in the webshop.

An example of such an error could occur once you upgrade both WooCommerce and Klarna. In this instance, the problem is created by the ‘woocommerce-gateway-klarna’ plugin which does not upgrade.

If this happens to you go to woocommerce-gateway-klarna ->includes->variables-checkout.php .

Look for:

if ( ! is_admin() && ! empty( $klarna_country )) {

and change it to:

if ( ! is_admin() && ! empty( $klarna_country ) && WC()->session ) {

503 Server Error: Service Unavailable

This error is usually temporary, and is caused by the server being too busy to handle the request. Try again a bit later.

If the issue continues to happen, it could mean that the server is overloaded with processes, and is close to maximum capacity.

Check the server load, to identify if this is the case.

520 Web Server Returned an Unknown Error

Usually this error is returned from CloudFlare, and often happens because of a bottleneck in Woocommerce that causes issues with higher Page Sizes. To fix it, simply set your Page Size to 50, and run a new sync:

522 Server Error: Connection Timed Out

This error usually happens if the server is too busy to respond, or if our importer is not allowed access to the server.

First, wait a few minutes and try syncing again, to see if the server was busy.

If it still does not work, make sure to whitelist the importers IP in your server configuration. The latest IP address can be found here.

Invalid response returned from the WooCommerce API

This error usually happens, if WooCommerce’s Debugging has been activated. This is never a good idea to have activated on a live-setup because it slows down pages, and potentially shows error messages in the frontend.

The sync issue happens if WooCommerce encounters an error while generating the product-data for the import.

This can be solved by deactivating Debugging in wp-config.php by setting define(WP_DEBUG’, false).

This guide explains it in more detail:

https://docs.woocommerce.com/document/woocommerce-product-search/api/debugging/

And this guide explains an alternate workaround:

https://aristath.github.io/blog/wp-hide-php-errors

Errors will still be logged even when not in Debug Mode, but they will be logged to a file instead.