Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebHooks are failing to complete some order but not all. #30

Open
wahid0003 opened this issue Nov 5, 2021 · 9 comments
Open

WebHooks are failing to complete some order but not all. #30

wahid0003 opened this issue Nov 5, 2021 · 9 comments

Comments

@wahid0003
Copy link

Notice: Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/woocommerce-fastspring-payment-gateway-master/woocommerce-gateway-fastspring.php on line 378

Notice: Undefined property: stdClass::$reference in /var/www/html/wp-content/plugins/woocommerce-fastspring-payment-gateway-master/includes/class-wc-gateway-fastspring-handler.php on line 288

@cyberwombat
Copy link
Owner

Can you give me the WP, WooCommerce version you are using please. Also when you say "not all" - is there a pattern? are some orders subscriptions for example?

@cyberwombat
Copy link
Owner

Also ensure you have debug enabled and check logs- see wiki

@wahid0003
Copy link
Author

wahid0003 commented Nov 6, 2021

WordPress 5.8.1
WooCommerce 5.8.0

All of my products are Subscription Products (Variations Subscription)

Some orders don't complete automatically.

For new orders, order status doesn't change from Pending Payment to Completed.

For Subscription renewal, the Subscription status changed to On-Hold and the renewal order status doesn't change from Pending Payment to Completed.

@cyberwombat
Copy link
Owner

Hmm I haven't tested it on later versions so that could be an issue. Ensure the log recording is on in settings and see what FS says - looks like it may not be finding the order. The first "notice" you recorded is suspicious as it seems to indicate that it's not able to record the reference which is something FS provides on initial purchase so that the webhook can find the order later once paid. I would suggest disabling as much as possible to see if you can eliminate the initial error messages if your log does show FS calling but saying it cannot find order. You can provide some of the relevant log parts here too if desired.

@jupiterdontcare
Copy link

I'm also having this issue, although I haven't seen the errors shown above. There is no obvious pattern to which orders fail in my case, but I do know that the webhook information provided by Fastspring shows that it's failing with a 503 error.

"response": { "status": 503, "statusText": "Service Temporarily Unavailable", "headers": { "Server": "nginx", "Date": "Sat, 01 Jan 2022 03:26:31 GMT", "Content-Type": "text/html", "Transfer-Encoding": "chunked", "Connection": "keep-alive", "Keep-Alive": "timeout=15" }, "body": "<html>\n<head>\n<title>The page is temporarily unavailable</title>\n<style>\nbody { font-family: Tahoma, Verdana, Arial, sans-serif; }\n</style>\n</head>\n<body bgcolor=\"white\" text=\"black\">\n<table width=\"100%\" height=\"100%\">\n<tr>\n<td align=\"center\" valign=\"middle\">\nThe page you are looking for is temporarily unavailable.<br/>\nPlease try again later.\n<br />\n027a06d9d65a0e985362ed45da54e695\nf81fb2af031a00cfaec2ef72643988ce\nb77ae2248c5e822ed12fbfcb4820b53f\n</td>\n</tr>\n</table>\n</body>\n</html>\n" }

What could potentially be causing it to become temporarily unavailable? Any help you could provide would be wonderful, I'm getting more and more incomplete orders all the time and having to manually approve them. This used to be very occasional but now it's nearly a daily thing.

@cyberwombat
Copy link
Owner

a 503 would indicate a potential slow response from your website. This could happen if you have too many orders (slow db), not running on an optimized server, a timeout somewhere... Not sure if this would show in your error log but Id be sure to turn debug and error tracking on. (https://kinsta.com/blog/http-error-503/ might help). Unfortunately there can be so many culprits so it's a matter of trial and error. Perhaps you can make another deploy without any extra plugins/theme that targets same database for the sake of FS? Might allow you to debug better. I've definitely seen Woo issues when too many orders in DB so purging old ones can help.

@jupiterdontcare
Copy link

Ok, I did as you suggested and tried removing cancelled orders, and have been watching the situation since. It definitely was the culprit. For a short time, I had absolutely no issues whatsoever, but now, as orders increase again, the problem is returning. I can't delete any completed orders because I have a library of digital products. Is my only option to change hosts? If so, how would I know which ones might avoid the problem? I only have like 400 orders so it's a joke to have "too many" at this stage...

Thank you for your help. I know it isn't exactly related to the plugin now but any direction would be very much appreciated.

@cyberwombat
Copy link
Owner

cyberwombat commented Jan 23, 2022

Ya 400 is nothing. When I saw issues like that it was around 50-100K. Id ensure your timeout is longer (i.e. https://tommcfarlin.com/resolving-php-timeouts-wordpress/) which you may or may not be able to change on your host. But I suspect there is a slow plugin/theme issue here. There is a plugin called Query Monitor which helps find slow DB calls and using the web inspector of the browser to see if there are slow loading assets. Things like social plugins can make a site super slow as they sometimes wait to make a call to their server - if you have stuff that loads after that its going to take forever. Try disabling all non essential plugins or theme features. Personally I would not use anything but WPEngine for hosting.

@cyberwombat
Copy link
Owner

Here you go: https://querymonitor.com/docs/ - while the idea way would be to replicate the exact call that FS does (which is possible but complex) I think this could give you insight. Since the FS call will cause Woo to search for an order and update it you may try the QM in a site area that has Woo doing something - could be the admin order search, the user account panel etc - hopefully that will help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants