Support » Plugin: WooCommerce Square » Updated to 2.2.0 and now can’t import/sync

  • Resolved kegobeer

    (@kegobeer)


    I performed a manual import and pulled a new product from my Square account to my WooCommerce installation and it worked perfectly. Then, I updated to version 2.2.0, and a few minutes later I did another import to get a brand new item just loaded to my Square account. Unfortunately it is now stuck in a sync loop. Here is the log information that shows the previous completed import/sync and the new and failing import/sync:

    08-31-2020 @ 15:59:10 - Starting step cycle: update_category_data
    08-31-2020 @ 15:59:10 - Completed job step: update_category_data
    08-31-2020 @ 15:59:10 - Completed step cycle: update_category_data (0.26s)
    08-31-2020 @ 15:59:11 - Starting step cycle: update_product_data
    08-31-2020 @ 15:59:11 - Completed job step: update_product_data
    08-31-2020 @ 15:59:11 - Completed step cycle: update_product_data (0.62s)
    08-31-2020 @ 15:59:12 - Starting step cycle: update_inventory_counts
    08-31-2020 @ 15:59:13 - Completed job step: update_inventory_counts
    08-31-2020 @ 15:59:13 - Completed step cycle: update_inventory_counts (0.32s)
    08-31-2020 @ 16:02:32 - Starting step cycle: import_products
    08-31-2020 @ 16:02:34 - Imported Products Count: 0
    08-31-2020 @ 16:02:34 - Completed step cycle: import_products (2.64s)
    08-31-2020 @ 16:02:35 - Starting step cycle: import_products
    08-31-2020 @ 16:02:37 - Imported Products Count: 0
    08-31-2020 @ 16:02:37 - Completed step cycle: import_products (1.80s)
    08-31-2020 @ 16:02:38 - Starting step cycle: import_products
    08-31-2020 @ 16:02:39 - Imported Products Count: 0
    08-31-2020 @ 16:02:39 - Completed step cycle: import_products (1.82s)
    08-31-2020 @ 16:02:40 - Starting step cycle: import_products
    08-31-2020 @ 16:02:43 - Imported Products Count: 0
    08-31-2020 @ 16:02:43 - Completed step cycle: import_products (2.58s)
    08-31-2020 @ 16:02:44 - Starting step cycle: import_products
    08-31-2020 @ 16:02:48 - Imported Products Count: 1
    08-31-2020 @ 16:02:48 - Completed job step: import_products
    08-31-2020 @ 16:02:48 - Completed step cycle: import_products (4.05s)
    08-31-2020 @ 16:02:48 - Starting step cycle: import_inventory
    08-31-2020 @ 16:02:49 - Completed step cycle: import_inventory (0.84s)
    08-31-2020 @ 16:02:50 - Starting step cycle: import_inventory
    08-31-2020 @ 16:02:51 - Completed step cycle: import_inventory (1.13s)
    08-31-2020 @ 16:02:52 - Starting step cycle: import_inventory
    08-31-2020 @ 16:02:54 - Completed step cycle: import_inventory (1.63s)
    08-31-2020 @ 16:02:54 - Starting step cycle: import_inventory
    08-31-2020 @ 16:02:56 - Completed step cycle: import_inventory (1.42s)
    08-31-2020 @ 16:02:57 - Starting step cycle: import_inventory
    08-31-2020 @ 16:02:59 - Completed step cycle: import_inventory (1.97s)
    08-31-2020 @ 16:02:59 - Starting step cycle: import_inventory
    08-31-2020 @ 16:03:02 - Completed step cycle: import_inventory (2.84s)
    08-31-2020 @ 16:03:04 - Starting step cycle: import_inventory
    08-31-2020 @ 16:03:07 - Completed step cycle: import_inventory (2.65s)
    08-31-2020 @ 16:03:07 - Starting step cycle: import_inventory
    08-31-2020 @ 16:03:10 - Completed step cycle: import_inventory (2.63s)
    08-31-2020 @ 16:03:11 - Starting step cycle: import_inventory
    08-31-2020 @ 16:03:13 - Completed step cycle: import_inventory (2.32s)
    08-31-2020 @ 16:03:14 - Starting step cycle: import_inventory
    08-31-2020 @ 16:03:16 - Completed step cycle: import_inventory (2.30s)
    08-31-2020 @ 16:03:17 - Starting step cycle: import_inventory
    08-31-2020 @ 16:03:20 - Completed step cycle: import_inventory (2.50s)
    08-31-2020 @ 16:03:20 - Starting step cycle: import_inventory
    08-31-2020 @ 16:03:23 - Completed step cycle: import_inventory (2.29s)
    08-31-2020 @ 16:03:23 - Starting step cycle: import_inventory
    08-31-2020 @ 16:03:26 - Completed step cycle: import_inventory (2.81s)
    08-31-2020 @ 16:03:27 - Starting step cycle: import_inventory
    08-31-2020 @ 16:03:28 - Completed job step: import_inventory
    08-31-2020 @ 16:03:28 - Completed step cycle: import_inventory (1.25s)
    08-31-2020 @ 16:20:25 - Starting upgrade to v2.2.0
    08-31-2020 @ 16:20:25 - Upgrade to v2.2.0 complete
    08-31-2020 @ 16:21:53 - Starting step cycle: import_products
    08-31-2020 @ 16:23:01 - Imported New Products Count: 0
    08-31-2020 @ 16:23:01 - Updated Products Count: 17
    08-31-2020 @ 16:23:01 - Completed step cycle: import_products (68.52s)
    08-31-2020 @ 16:23:02 - Starting step cycle: import_products
    08-31-2020 @ 16:32:27 - Starting step cycle: import_products
    08-31-2020 @ 16:37:31 - Starting step cycle: import_products

    You can see the import that started at 16:21:53 just keeps going.

Viewing 15 replies - 1 through 15 (of 55 total)
  • Thread Starter kegobeer

    (@kegobeer)

    I let it run for 45 minutes and it still didn’t complete the import. I disconnected Square and reconnected, then did just a sync, which worked. I tried another import and it got stuck again.

    I disconnected, reconnected, and rolled back to 2.1.6 and the new item was successfully imported in about 2 minutes.

    mattallan

    (@mattallan)

    Hi @kegobeer thanks for the details report and apologies for the issues you’ve ran into after updating to Square 2.2.0.

    I’m not able to reproduce the issue you’re having on my own development store so we’ll need some more information to help diagnose what is causing this to happen.

    Here’s what I think might be happening though. In 2.2.0 we changed the import process to now also update any existing products in Woo that have been previously imported. In your logs I can see that 17 products were updated on the first import you ran after upgrading to 2.2.0.

    The second import_products process gets stuck and never gets marked as completed for some reason. One possible cause is there may be some PHP fatal error being thrown when trying to create or update a product from square.

    Do you have PHP error logs available to look at?

    Thanks!

    Thread Starter kegobeer

    (@kegobeer)

    I didn’t see any PHP errors in my Siteground control panel. I will upgrade to 2.2.0 again and do another import and see if I get any errors reported.

    Thread Starter kegobeer

    (@kegobeer)

    Here’s what I got:

    2020-09-02 03:39:21 UTC [apache][:warn] [pid 4737] [client xx.xx.xx.xx:46072] Timeout waiting for output from CGI script /XXX/XXX/www/.com/public_html/wp-admin/admin-ajax.php, referer: https://www..com/wp-admin/admin-ajax.php?action=wc_square_background_sync&nonce=1cd16ac983
    ‮
    2020-09-02 03:38:21 UTC [apache][:warn] [pid 4737] [client xx.xx.xx.xx:46072] Timeout waiting for output from CGI script /XXX/XXX/www/.com/public_html/wp-admin/admin-ajax.php, referer: https://www..com/wp-admin/admin-ajax.php?action=wc_square_background_sync&nonce=1cd16ac983
    ‮
    2020-09-02 03:37:14 UTC [apache][:warn] [pid 473] [client xx.xx.xx.xx:57124] Timeout waiting for output from CGI script /XXX/XXX/www/.com/public_html/wp-admin/admin-ajax.php, referer: https://www..com/wp-admin/admin-ajax.php?action=wc_square_background_sync&nonce=1cd16ac983

    If you need the complete URL I can send the log via PM.

    I know that Siteground will not increase the timeout for shared hosting, so hopefully there’s another solution for this issue.

    • This reply was modified 1 year ago by kegobeer.
    Plugin Contributor mattdallan

    (@mattdallan)

    Hi @kegobeer, thanks for getting that information to us!

    Do you know how long Sitegrounds timeout is? Square defaults to 5 minutes (300 seconds) and from googling around, I see some people mention Siteground has a 30 second timeout. Given that, you could try using the following filter to change the max execution time we use in Square.

    
    function kegobeer_set_square_time_limit( $default_time ) {
        return 30;
    }
    
    apply_filters( 'wc_square_time_limit', 'kegobeer_set_square_time_limit', 10, 1 );
    

    It’s worth mentioning that we didn’t change anything in version 2.2.0 that would cause this to start breaking, so if it’s working when you reverted back to 2.1.6 there must be something else causing this problem.

    Do you have any fatal errors logged in WooCommerce? Here’s a link for how to check for these: https://docs.woocommerce.com/document/finding-php-error-logs/#section-1

    Thread Starter kegobeer

    (@kegobeer)

    Nope, no fatal errors at all, just the timeout errors logged in my Siteground control panel.

    I get a cron job timeout often as well. I’ll reattack this with Siteground support to see if there’s anything they can do. I’ll add that filter to my WP to see if it helps.

    I don’t know what the timeout is, and the support pages only mention that the limit can’t be changed – nothing about what the limit is. I’ll ask them in the support ticket.

    I’ll let you know what I find out from them and if the filter helps.

    Thanks for the help.

    Thread Starter kegobeer

    (@kegobeer)

    Unfortunately the filter didn’t work. I will open a ticket and see if I can get some help from Siteground.

    Thread Starter kegobeer

    (@kegobeer)

    Siteground support helped me out with the timeout problem. Using htaccess I was able to increase the timeout for ajax.php and admin.php to 300 seconds, so the import on 2.2.0 now works. It’s incredibly slow though, is that the way the import process will be now?

    Plugin Contributor mattdallan

    (@mattdallan)

    Hi @kegobeer,

    Thanks for the updates on your issue and I’m glad to hear that the import is now working, but I understand it’s still very slow.

    Since the import process now also updates existing products from Square (previously these were skipped), it’s possible some update queries to the DB may be slowing this process down now.

    One option our team will look into is allowing store managers to run the import without updating products. Either by selecting or deselecting some checkbox after clicking “Import all products from Square” or adding some filter to toggle it off with a code snippet.

    How many products do you have in Square and how long is it taking to complete the import process?

    Thanks!

    popped

    (@popped)

    I am having this same issue, since the update I can’t import. It’s been trying for 2 days. I’ve disconnected and reconnected square!! Frustrated and not sure how to fix.

    Thread Starter kegobeer

    (@kegobeer)

    @popped Have you checked your hosting control panel error logs? That’s where I found that the php script was timing out. My host is Siteground and they gave me some code for my .htaccess file that increased the timeout to 300 seconds, and that fixed the problem for me.

    popped

    (@popped)

    @kegobeer trying now, they said they don’t change it with httaccess, they change it in php.ini. Testing now to see if it works, so far it’s just spinning.

    Thread Starter kegobeer

    (@kegobeer)

    @popped
    There is a setting in php.ini for timeout, but there is also a way to do specific files in .htaccess. Here is what I use:

    <IfModule mod_dtimeout.c>
    <Files ~ ".php">
    SetEnvIf Request_URI "index.php" DynamicTimeout=300
    SetEnvIf Request_URI "wp-admin/themes.php" DynamicTimeout=300
    SetEnvIf Request_URI "wp-admin/admin-ajax.php" DynamicTimeout=300
    SetEnvIf Request_URI "wp-admin/admin.php" DynamicTimeout=300
    SetEnvIf Request_URI "wp-cron.php" DynamicTimeout=300
    </Files>
    </IfModule>

    I added the wp-cron.php line because I was also getting timeouts when the cron was firing.

    • This reply was modified 1 year ago by kegobeer.
    popped

    (@popped)

    @kegobeer Testing now, may take awhile. I added a lot of products the last couple of days.

    Thread Starter kegobeer

    (@kegobeer)

    @popped I had one tab open on the Woocommerce -> Square -> Settings -> Update page during the import, another tab open to the current Square log open during the import process (Woocommerce -> status -> logs), refreshing it every few minutes, and a third tab open on my hosting site control panel error log. That helped me see what was happening during the import.

Viewing 15 replies - 1 through 15 (of 55 total)
  • The topic ‘Updated to 2.2.0 and now can’t import/sync’ is closed to new replies.