Skip to content

Customer Webhooks Trying to use V2 of API instead of V3 #470

@davidrhino

Description

@davidrhino

Expected behavior

Customer Webhooks are supposed to be received with Version 3 of the API but are trying to use Version 2.

Actual behavior

This site uses only default Customer Webhooks created by the plugin and no others. We had the customer's webhook disabled on the site because of the errors that BC has made over time. The problem is when the account changes on the BC side updates are not reflected on the WordPress Side. This is a huge problem as sometimes people aren't able to login or updates aren't reflected properly. Also, a big issue is when the customer chooses to create an account in the BC checkout, it won't get synced down to WordPress because of this error.

Here is the stack trace.
2024-09-09T14:36:32.123802+00:00] PHP Fatal error: Uncaught TypeError: BigCommerce\Webhooks\Customer\Customer_Saver::__construct(): Argument #1 ($customers_api) must be of type BigCommerce\Api\v3\Api\CustomersApi, BigCommerce\Api\Customer_Api given, called in /wp-content/plugins/bigcommerce/src/BigCommerce/Container/Webhooks.php on line 147 and defined in /wp-content/plugins/bigcommerce/src/BigCommerce/Webhooks/Customer/Customer_Saver.php:21
Stack trace:
#0 /wp-content/plugins/bigcommerce/src/BigCommerce/Container/Webhooks.php(147): BigCommerce\Webhooks\Customer\Customer_Saver->__construct(Object(BigCommerce\Api\Customer_Api))
#1 /wp-content/plugins/bigcommerce/vendor/pimple/pimple/src/Pimple/Container.php(118): BigCommerce\Container\Webhooks->BigCommerce\Container{closure}(Object(Pimple\Container))
#2 /wp-content/plugins/bigcommerce/src/BigCommerce/Container/Webhooks.php(298): Pimple\Container->offsetGet('webhooks.cron.c...')
#3 /wp-includes/class-wp-hook.php(324): BigCommerce\Container\Webhooks->BigCommerce\Container{closure}(32870)
#4 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#5 /wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 /wp-content/plugins/bigcommerce/src/BigCommerce/Webhooks/Customer/Customer_Create_Webhook.php(37): do_action('bigcommerce/web...', 32870)
#7 /wp-content/plugins/bigcommerce/src/BigCommerce/Webhooks/Webhook.php(297): BigCommerce\Webhooks\Customer\Customer_Create_Webhook->trigger_action(Array)
#8 /wp-content/plugins/bigcommerce/src/BigCommerce/Webhooks/Webhook_Listener.php(45): BigCommerce\Webhooks\Webhook->receive()
#9 /wp-content/plugins/bigcommerce/src/BigCommerce/Container/Webhooks.php(274): BigCommerce\Webhooks\Webhook_Listener->handle_request(Array)
#10 /wp-includes/class-wp-hook.php(324): BigCommerce\Container\Webhooks->BigCommerce\Container{closure}(Array)
#11 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#12 /wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#13 /wp-content/plugins/bigcommerce/src/BigCommerce/Rewrites/Action_Endpoint.php(30): do_action('bigcommerce/act...', Array)
#14 /wp-content/plugins/bigcommerce/src/BigCommerce/Container/Rewrites.php(26): BigCommerce\Rewrites\Action_Endpoint->handle_request(Object(WP))
#15 /wp-includes/class-wp-hook.php(324): BigCommerce\Container\Rewrites->BigCommerce\Container{closure}(Object(WP))
#16 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#17 /wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#18 /wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array)
#19 /wp-includes/class-wp.php(813): WP->parse_request('')
#20 /wp-includes/functions.php(1336): WP->main('')
#21 /wp-blog-header.php(16): wp()
#22 /index.php(17): require('/nas/content/li...')
#23 {main}
thrown in /wp-content/plugins/bigcommerce/src/BigCommerce/Webhooks/Customer/Customer_Saver.php on line 21

Steps to reproduce behavior

  1. Have the latest plugin installed
  2. Make sure webhooks are turned on for customer and show up in Diagnostics information.
  3. Change something on the customer side of a customer that already exists or doesn't exist.
  4. The webhook will send to the instance and then error out with the message.

Workaround or possible solution

There is no known workaround other than turning off the Customer Webhooks which is not advised.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions