bigcommerce / bigcommerce-for-wordpress

A headless commerce integration for WordPress, powered by BigCommerce
https://www.bigcommerce.com/wordpress/
GNU General Public License v2.0
110 stars 48 forks source link

Unable to sync products between BigCommerce and Dreamhost WordPress #454

Open brod55 opened 9 months ago

brod55 commented 9 months ago

Expected behavior

Products to be synchronized from Bigcommerce to Wordpress.

Actual behavior

Process stalls at Steps 5 of 13. One category and 1 product is pulled.

Steps to reproduce behavior

  1. Get a Dreamhost manage Wordpress instance
  2. Install BigCommerce Wordpres Plugin
  3. Login to your BigCommerce store through Wordpress Plugin
  4. Either wait for Cronjob or manually synchronize products it will pause at steps 5 of 13

Screenshot/Video (if applicable)

image

Workaround or possible solution

If use a VM from Dreamhost and install Wordpress fresh. Everything works fine. It appears to be the combination between the BigCommerce Wordpress Plugin and Dreamhost managed Wordpress.

Additional Info

It doesn't matter if webhooks are enabled or not. We've on many does of support calls between Bigcommerce and Dreamhost. We've changed batch size.

Debug Logs

[2024-01-31 20:00:02] BigCommerce.INFO: Releasing expired import lock {"status":{"timestamp":1706730901.9299,"status":"updating_categories"}} [] [2024-01-31 20:00:09] BigCommerce.INFO: Running import task {"state":"updating_categories","description":"Updating Categories"} [] [2024-01-31 20:00:10] BigCommerce.ERROR: Could not retrieve the token {"trace":"#0 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(150): BigCommerce\GraphQL\BaseGQL->parse_response(Array)\n#1 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(111): BigCommerce\GraphQL\BaseGQL->make_request('{\"channel_id\":1...', Array, 'https://api.big...')\n#2 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(57): BigCommerce\GraphQL\BaseGQL->request_token()\n#3 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(32): BigCommerce\GraphQL\BaseGQL->get_token()\n#4 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/GraphQL_Processor.php(14): BigCommerce\GraphQL\BaseGQL->construct(Object(BigCommerce\Api\Configuration))\n#5 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/GraphQL.php(35): BigCommerce\GraphQL\GraphQL_Processor->construct(Object(BigCommerce\Api\Configuration), Array)\n#6 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/vendor/pimple/pimple/src/Pimple/Container.php(118): BigCommerce\Container\GraphQL->BigCommerce\Container\{closure}(Object(Pimple\Container))\n#7 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(195): Pimple\Container->offsetGet('bigcommerce.gra...')\n#8 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/vendor/pimple/pimple/src/Pimple/Container.php(118): BigCommerce\Container\Import->BigCommerce\Container\{closure}(Object(Pimple\Container))\n#9 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(294): Pimple\Container->offsetGet('import.categori...')\n#10 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Task_Manager.php(97): BigCommerce\Container\Import->BigCommerce\Container\{closure}('updating_catego...')\n#11 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(369): BigCommerce\Import\Task_Manager->run_next('updating_catego...')\n#12 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(324): BigCommerce\Container\Import->BigCommerce\Container\{closure}('updating_catego...')\n#13 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)\n#14 /home/dh_5umpn5/domain.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#15 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Runner/Cron_Runner.php(53): do_action('bigcommerce/imp...', 'updating_catego...')\n#16 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(132): BigCommerce\Import\Runner\Cron_Runner->continue_import()\n#17 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(322): BigCommerce\Container\Import->BigCommerce\Container\{closure}()\n#18 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)\n#19 /home/dh_5umpn5/domain.com/wp-includes/plugin.php(565): WP_Hook->do_action(Array)\n#20 /home/dh_5umpn5/domain.com/wp-cron.php(191): do_action_ref_array('bigcommerce_con...', Array)\n#21 {main}"} [] [2024-01-31 20:00:10] BigCommerce.ERROR: Could not retrieve the token {"trace":"#0 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(150): BigCommerce\GraphQL\BaseGQL->parse_response(Array)\n#1 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(85): BigCommerce\GraphQL\BaseGQL->make_request('{\"channel_id\":1...', Array, 'https://api.big...')\n#2 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(68): BigCommerce\GraphQL\BaseGQL->request_im_token()\n#3 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(33): BigCommerce\GraphQL\BaseGQL->get_impersonation_token()\n#4 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/GraphQL_Processor.php(14): BigCommerce\GraphQL\BaseGQL->construct(Object(BigCommerce\Api\Configuration))\n#5 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/GraphQL.php(35): BigCommerce\GraphQL\GraphQL_Processor->construct(Object(BigCommerce\Api\Configuration), Array)\n#6 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/vendor/pimple/pimple/src/Pimple/Container.php(118): BigCommerce\Container\GraphQL->BigCommerce\Container\{closure}(Object(Pimple\Container))\n#7 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(195): Pimple\Container->offsetGet('bigcommerce.gra...')\n#8 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/vendor/pimple/pimple/src/Pimple/Container.php(118): BigCommerce\Container\Import->BigCommerce\Container\{closure}(Object(Pimple\Container))\n#9 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(294): Pimple\Container->offsetGet('import.categori...')\n#10 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Task_Manager.php(97): BigCommerce\Container\Import->BigCommerce\Container\{closure}('updating_catego...')\n#11 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(369): BigCommerce\Import\Task_Manager->run_next('updating_catego...')\n#12 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(324): BigCommerce\Container\Import->BigCommerce\Container\{closure}('updating_catego...')\n#13 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)\n#14 /home/dh_5umpn5/domain.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#15 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Runner/Cron_Runner.php(53): do_action('bigcommerce/imp...', 'updating_catego...')\n#16 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(132): BigCommerce\Import\Runner\Cron_Runner->continue_import()\n#17 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(322): BigCommerce\Container\Import->BigCommerce\Container\{closure}()\n#18 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)\n#19 /home/dh_5umpn5/domain.com/wp-includes/plugin.php(565): WP_Hook->do_action(Array)\n#20 /home/dh_5umpn5/domain.com/wp-cron.php(191): do_action_ref_array('bigcommerce_con...', Array)\n#21 {main}"} [] [2024-01-31 20:00:10] BigCommerce.DEBUG: Importing terms for bigcommerce_category taxonomy {"limit":1,"taxonomy":"bigcommerce_category"} [] [2024-01-31 20:00:10] BigCommerce.ERROR: Could not retrieve the token {"trace":"#0 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(150): BigCommerce\GraphQL\BaseGQL->parse_response(Array)\n#1 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(111): BigCommerce\GraphQL\BaseGQL->make_request('{\"channel_id\":1...', Array, 'https://api.big...')\n#2 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(57): BigCommerce\GraphQL\BaseGQL->request_token()\n#3 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(233): BigCommerce\GraphQL\BaseGQL->get_token()\n#4 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(270): BigCommerce\GraphQL\BaseGQL->get_auth_bearer(false)\n#5 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/BaseGQL.php(130): BigCommerce\GraphQL\BaseGQL->get_headers()\n#6 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/GraphQL/GraphQL_Processor.php(207): BigCommerce\GraphQL\BaseGQL->make_request(Array)\n#7 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Processors/Category_Import.php(60): BigCommerce\GraphQL\GraphQL_Processor->get_category_tree()\n#8 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Processors/Term_Import.php(79): BigCommerce\Import\Processors\Category_Import->get_source_data()\n#9 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(294): BigCommerce\Import\Processors\Term_Import->run()\n#10 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Task_Manager.php(97): BigCommerce\Container\Import->BigCommerce\Container\{closure}('updating_catego...')\n#11 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(369): BigCommerce\Import\Task_Manager->run_next('updating_catego...')\n#12 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(324): BigCommerce\Container\Import->BigCommerce\Container\{closure}('updating_catego...')\n#13 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)\n#14 /home/dh_5umpn5/domain.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#15 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Runner/Cron_Runner.php(53): do_action('bigcommerce/imp...', 'updating_catego...')\n#16 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(132): BigCommerce\Import\Runner\Cron_Runner->continue_import()\n#17 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(322): BigCommerce\Container\Import->BigCommerce\Container\{closure}()\n#18 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)\n#19 /home/dh_5umpn5/domain.com/wp-includes/plugin.php(565): WP_Hook->do_action(Array)\n#20 /home/dh_5umpn5/domain.com/wp-cron.php(191): do_action_ref_array('bigcommerce_con...', Array)\n#21 {main}"} [] [2024-01-31 20:00:11] BigCommerce.DEBUG: GraphQL credentials were missing. No token was sent. {"response":null,"headers":null} [] [2024-01-31 20:00:11] BigCommerce.INFO: Unable to fetch categories with GraphQL. Fallback to REST API [] []

brod55 commented 9 months ago

Willing to hire someone to fix this problem and submit a PR request back to this project.

brod55 commented 9 months ago

image

2gen commented 9 months ago

I suspect the php settings you should be looking at are memory limit and max execution time.

If that is the cause you could try reducing the amount of products it imports per batch to 1 and see if it works.

brod55 commented 9 months ago

I have tried batch size 1. I have tried from different Dreamhost managed Wordpress sites. I have tried with different BigCommerce accounts. They all have the same exact symptoms.

image image

brod55 commented 9 months ago

Getting this error: [05-Feb-2024 08:35:46 UTC] PHP Fatal error: Uncaught Error: Undefined constant "BigCommerce\Import\IMAGETYPE_SWC" in /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Importers/Terms/Term_Saver.php:203 Stack trace:

0 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Importers/Terms/Term_Saver.php(38): BigCommerce\Import\Importers\Terms\Term_Saver->import_image(Object(BigCommerce\Api\v3\Model\Category))

1 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Processors/Term_Import.php(137): BigCommerce\Import\Importers\Terms\Term_Saver->do_import()

2 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Processors/Term_Import.php(111): BigCommerce\Import\Processors\Term_Import->do_term_import(Object(BigCommerce\Api\v3\Model\Category), true)

3 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(294): BigCommerce\Import\Processors\Term_Import->run()

4 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Task_Manager.php(97): BigCommerce\Container\Import->BigCommerce\Container{closure}('purged_brands')

5 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(369): BigCommerce\Import\Task_Manager->run_next('purged_brands')

6 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(324): BigCommerce\Container\Import->BigCommerce\Container{closure}('purged_brands')

7 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)

8 /home/dh_5umpn5/domain.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array)

9 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Runner/Cron_Runner.php(53): do_action('bigcommerce/imp...', 'purged_brands')

10 /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Container/Import.php(132): BigCommerce\Import\Runner\Cron_Runner->continue_import()

11 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(322): BigCommerce\Container\Import->BigCommerce\Container{closure}()

12 /home/dh_5umpn5/domain.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)

13 /home/dh_5umpn5/domain.com/wp-includes/plugin.php(565): WP_Hook->do_action(Array)

14 /home/dh_5umpn5/domain.com/wp-cron.php(191): do_action_ref_array('bigcommerce_con...', Array)

15 {main}

thrown in /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Importers/Terms/Term_Saver.php on line 203

brod55 commented 9 months ago

I have confirmed that the only difference between a working import and a non-working import is there in the above comment is from a non-working system:

PHP Fatal error: Uncaught Error: Undefined constant "BigCommerce\Import\IMAGETYPE_SWC" in /home/dh_5umpn5/domain.com/wp-content/plugins/bigcommerce/src/BigCommerce/Import/Importers/Terms/Term_Saver.php:203

brod55 commented 9 months ago

It is working now and I would like to understand why. To fix the problem, I commented out line 39 of wp-content/plugins/bigcommerce/src/BigCommerce/Import/Image_Importer.php:

    const MIMES = [
            IMAGETYPE_GIF     => 'image/gif',
            IMAGETYPE_JPEG    => 'image/jpg',
            IMAGETYPE_PNG     => 'image/png',
            IMAGETYPE_SWF     => 'image/swf',
            IMAGETYPE_PSD     => 'image/psd',
            IMAGETYPE_BMP     => 'image/bmp',
            IMAGETYPE_TIFF_II => 'image/tiff',
            IMAGETYPE_TIFF_MM => 'image/tiff',
            IMAGETYPE_JPC     => 'image/jpc',
            IMAGETYPE_JP2     => 'image/jp2',
            IMAGETYPE_JPX     => 'image/jpx',
            IMAGETYPE_JB2     => 'image/jb2',
            //IMAGETYPE_SWC     => 'image/swc',
            IMAGETYPE_IFF     => 'image/iff',
            IMAGETYPE_WBMP    => 'image/wbmp',
            IMAGETYPE_XBM     => 'image/xbm',
            IMAGETYPE_ICO     => 'image/ico',