woocommerce / woocommerce-paypal-payments

https://wordpress.org/plugins/woocommerce-paypal-payments/
GNU General Public License v2.0
61 stars 47 forks source link

Uncaught InvalidArgumentException: PayPal order ID not found in meta #2317

Closed InfinityOmega closed 1 month ago

InfinityOmega commented 1 month ago

Describe the Bug

Using a Rest API call to update tracking for orders shipped using 3rd party software. We are not able to update tracking on any orders when the WooCommerce PayPal Payments plugin is active. Doesn't matter if the order was using PayPal or another method. We had dozens of orders stuck in pending status without being able to update any of them using our automation tools.

If we manually go into each order with a web browser we can apply the tracking code successfully even when the Paypal plugin is active.

When the plugin is active the call generates an "Uncaught InvalidArgumentException: PayPal order ID not found in meta." When disabled the update goes through fine - like it has for the past year+.

All plugins and WC are up to date.

Digging through logs, this appears to have started around May 28th.

To Reproduce

Send API update to WC with Paypal plugin enabled

Screenshots

Expected Behavior

We expect the tracking number to be applied to the correct order and the order completed.

Actual Behavior

Tracking number is not applied to any orders. Uncaught InvalidArgumentException: PayPal order ID not found in meta.

Environment

Additional Details

Here is a redacted version of the error message generated-

{ "Date":"Wed, 29 May 2024 17:41:10 GMT", "Content-Type":"application/json; charset=UTF-8", "Content-Length":"3198", "Connection":"keep-alive", "Set-Cookie":"xxxxxxxxxxxxxxxxx; path=/; secure; HttpOnly, tax_exempt=excl; expires=Wed, 05 Jun 2024 17:41:09 GMT; Max-Age=604800; path=/, wfwaf-authcookie-xxxxxxxxxxxxxxxxx=1%7Cadministrator%7Cmanage_options%2Cunfiltered_html%2Cedit_others_posts%2Cupload_files%2Cpublish_posts%2Cedit_posts%2Cread%7Caxxxxxxxxxxx; expires=Thu, 30 May 2024 05:41:09 GMT; Max-Age=43200; path=/; secure; HttpOnly, __xxxxxxxxxxxxxxxxxQ; path=/; expires=Wed, 29-May-24 18:11:10 GMT; domain=.mydomain.com; HttpOnly; Secure; SameSite=None", "X-Robots-Tag":"noindex", "Link":"https://mydomain.com/wp-json/; rel=\"https://api.w.org/\"", "X-Content-Type-Options":"nosniff", "Access-Control-Expose-Headers":"X-WP-Total, X-WP-TotalPages, Link", "Access-Control-Allow-Headers":"Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type", "Expires":"Wed, 11 Jan 1984 05:00:00 GMT", "Cache-Control":"no-cache, must-revalidate, max-age=0, no-store, private", "X-Powered-By":"WP Engine", "CF-Cache-Status":"DYNAMIC", "Server":"cloudflare", "CF-RAY":"88b846092bf060a2-ORD", "alt-svc":"h3=\":443\"; ma=86400" }"code":"500 resp":{ "code":"internal_server_error", "message":"

There has been a critical error on this website.<\/p>

<a href=\"https:\/\/wordpress.org\/documentation\/article\/faq-troubleshooting\/\">Learn more about troubleshooting WordPress.<\/a><\/p>", "data":{ "status":500, "error":{ "type":1, "message":"Uncaught InvalidArgumentException: PayPal order ID not found in meta. in \/nas\/content\/live\/mydomain\/wp-content\/plugins\/woocommerce-paypal-payments\/api\/order-functions.php:38\nStack trace:\n#0 \/nas\/content\/live\/mydomain\/wp-content\/plugins\/woocommerce-paypal-payments\/modules\/ppcp-order-tracking\/src\/Integration\/ShipmentTrackingIntegration.php(124): WooCommerce\PayPalCommerce\Api\ppcp_get_paypal_order('')\n#1 \/nas\/content\/live\/mydomain\/wp-includes\/class-wp-hook.php(324): WooCommerce\PayPalCommerce\OrderTracking\Integration\ShipmentTrackingIntegration->WooCommerce\PayPalCommerce\OrderTracking\Integration\{closure}(Object(WP_REST_Response), Array, Object(WP_REST_Request))\n#2 \/nas\/content\/live\/mydomain\/wp-includes\/plugin.php(205): WP_Hook->apply_filters(Object(WP_REST_Response), Array)\n#3 \/nas\/content\/live\/mydomain\/wp-content\/plugins\/woocommerce-shipment-tracking\/includes\/api\/class-wc-shipment-tracking-order-rest-api-controller.php(372): apply_filters('woocommerce_res...', Object(WP_REST_Response), Array, Object(WP_REST_Request))\n#4 \/nas\/content\/live\/mydomain\/wp-content\/plugins\/woocommerce-shipment-tracking\/includes\/api\/class-wc-shipment-tracking-order-rest-api-controller.php(263): WC_Shipment_Tracking_Order_REST_API_Controller->prepare_item_for_response(Array, Object(WP_REST_Request))\n#5 \/nas\/content\/live\/mydomain\/wp-includes\/rest-api\/class-wp-rest-server.php(1230): WC_Shipment_Tracking_Order_REST_API_Controller->create_item(Object(WP_REST_Request))\n#6 \/nas\/content\/live\/mydomain\/wp-includes\/rest-api\/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '\/wc-shipment-tr...', Array, NULL)\n#7 \/nas\/content\/live\/mydomain\/wp-includes\/rest-api\/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request))\n#8 \/nas\/content\/live\/mydomain\/wp-includes\/rest-api.php(428): WP_REST_Server->serve_request('\/wc-shipment-tr...')\n#9 \/nas\/content\/live\/mydomain\/wp-includes\/class-wp-hook.php(324): rest_api_loaded(Object(WP))\n#10 \/nas\/content\/live\/mydomain\/wp-includes\/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)\n#11 \/nas\/content\/live\/mydomain\/wp-includes\/plugin.php(565): WP_Hook->do_action(Array)\n#12 \/nas\/content\/live\/mydomain\/wp-includes\/class-wp.php(418): do_action_ref_array('parse_request', Array)\n#13 \/nas\/content\/live\/mydomain\/wp-includes\/class-wp.php(813): WP->parse_request('')\n#14 \/nas\/content\/live\/mydomain\/wp-includes\/functions.php(1336): WP->main('')\n#15 \/nas\/content\/live\/mydomain\/wp-blog-header.php(16): wp()\n#16 \/nas\/content\/live\/mydomain\/index.php(17): require('\/nas\/content\/li...')\n#17 {main}\n thrown", "file":"\/nas\/content\/live\/mydomain\/wp-content\/plugins\/woocommerce-paypal-payments\/api\/order-functions.php", "line":38 } }, "additional_errors":[

] }

System status ``` ```
InfinityOmega commented 1 month ago

After further research this appears to be a duplicate of:

2305

2289

Testing workarounds to confirm.

InfinityOmega commented 1 month ago

Confirmed updated plugin resolves the issue.