Stripe Webhooks timing out

Hello. s2member Pro subscriber. I’m working on resolving webhooks timing out issue. I have not had a successful webhook since August 31st. I do not recall doing any major updates/changes at that time. Here’s my progress so far.

1) Stripe notified me that webhooks have been failing since Sept 4th. Webhook: The URL of the failing webhook endpoint is: https://www.xxx.com/?s2member_pro_stripe_notify=1 . If I check my Stripe dashboard

2) If I access that URL, it returns a 200 network message (good). Relevant errors in my logs:

Safari/537.36
Array
(
[s2member_log] => Array
(
[0] => Unable to verify Webhook/IPN event ID. This is most likely related to an invalid Stripe configuration. Please check: s2Member → Stripe Options.
[1] => If you’re absolutely SURE that your Stripe configuration is valid, you may want to run some tests on your server, just to be sure $_POST variables (and php://input) are populated; and that your server is able to connect to Stripe over an HTTPS connection.
[2] => s2Member uses the Stripe SDK for remote connections; which relies upon the cURL extension for PHP. Please make sure that your installation of PHP has the cURL extension; and that it’s configured together with OpenSSL for HTTPS communication.
[3] => array (
‘s2member_pro_stripe_notify’ => ‘1’,


Array
(
[customer_id] => cus_NvL3AjRmddE45
[subscription_id] => sub_1N9UNrPRddAj54IWcR0Xk
[input_time] => 16922357
)

-------- Output string/vars: ( Sat, 09 Sep 23 01:19:43 +0000 ) --------
Stripe\Exception\ApiConnectionException Object
(
[error:protected] =>
[httpBody:protected] =>
[httpHeaders:protected] =>
[httpStatus:protected] =>
[jsonBody:protected] =>
[requestId:protected] =>
[stripeCode:protected] =>
[message:protected] => Could not connect to Stripe (https://api.stripe.com/v1/customers/cus_NvlMAjRmE45). Please check your internet connection and try again. If this problem persists, you should check Stripe’s service status at https://twitter.com/stripestatus, or let us know at support@stripe.com.

(Network error [errno 7]: Failed to connect to api.stripe.com port 443: Connection timed out)
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /home/ecuser/xxxxx/lib/HttpClient/CurlClient.php
[line:protected] => 374
[trace:Exception:private] => Array
(
[0] => Array
(


  1. I contacted Dreamhost (my shared hosting provider). The first support analysis said 1) "Based from the server, it seemed to have been running out of PHP memory/RAM. Relevant logs below:
    ===

Thu Sep 7 19:50:02 2023 procwatch3 INFO: PID 394112 (php80.cgi) ecuser:pg1989116 - 103.7MB ram, 91.15 sec cpu: reniced to +10
Thu Sep 7 20:59:42 2023 procwatch3 INFO: PID 429162 (php80.cgi) ecuser:pg1989116 - 91.2MB ram, 90.83 sec cpu: reniced to +10
Thu Sep 7 21:10:46 2023 procwatch3 INFO: PID 23744 (php80.cgi) ecuser:pg1989116 - 103.8MB ram, 90.40 sec cpu: reniced to +10
Thu Sep 7 21:10:46 2023 procwatch3 INFO: PID 23744 (php80.cgi) ecuser:pg1989116 - 103.8MB ram, 90.40 sec cpu: reniced to +10
====
He also indicated that the log just suggests the site is not compatible with PHP 8.0

[Thu Sep 07 21:20:34.015003 2023] [fcgid:warn] [pid 415754:tid 3804877063936] [client 69.172.186.13:58474] mod_fcgid: stderr: PHP Warning: Constant ABSPATH already defined in /home/ecxxxxx/xxxt.com/wp-config.php on line 40, referer: https://www.xxxxx.com/wp-admin/admin.php?page=ws-plugin--s2member-pro-stripe-ops

==
He suggests that I could update it to PHP8.1. He then referred me to second-level tech support.

4) They emailed me, asking me to test the connection to:

chameg:~# curl -I https://api.stripe.com , which is apparently hanging. They asked me to “have them look over the IP address: 69.163.152.129 To see if there are any blocks from their end”

5) Stripe confirms there are no blocks.
6) Dreamhost tech support comments:

I updated the sites max_execution_time to the below value if that helps:
max_execution_time = 500

You can ask Stripe if they have any required PHP settings that we need to
configure. I also updated other directives via .phprc file to see if that helps.

7) These changes do not help. Webhooks continue to fail. I contact Stripe to see if there are any “required PHP settings” needed to be updated. I await a response. That’s where I stand today.

Hoping to get this resolved. If you have any insights, please let me know. Will update the post as I continue to work on it.

Update: Not fixed yet. Noticed that customer sign-ups have not worked since August 31st as well (though subscription updates work). On Stripe under logs, I can see the “POST /v1/payment_methods” data for new user sign ups, but these users aren’t being created on WP or Stripe and no payment is received. It makes me sick to know that users are trying to sign up and pay and the site isn’t working.

My server, Dreamhost, has had me toggle mod_security, updated max_execution_time to 500, and tweaked .phprc, all to no avail.

I am currently waiting to hear back from Stripe re: if there any custom PHP settings needed. It’s been three days…

things working allright with Stripe for me. But yeah I know why any kind of e-commerce site isn’t made for shared hosting. It’s well worth to run you own root server. Any decent cloud provider will do - just make sure to go for at least 8GB dedicated memory - 128MB of RAM for PHP is really stretching it. I would dedicate at least 256MB to PHP per worker. I’m using 512 just to be safe.
And I’m using PHP 8.2 - but 8.0 or 8.1 should still work.

Also wordpress memory limit I would set to 512MB. I’ve seen quite often close to 200MB used.

Thanks for the reply. To solve the issue, I ended up upgrading to Dreamhost’s basic VPS plan ($12.99/mo if paid for 3 years). It only has 1GB of memory but should be an upgrade from the shared world.

It sounds like the problem was caused by Stripe. We were able to demonstrate that if we send a curl command to Stripe’s API from my IP, it was timing out, yet working for other IPs. Stripe said AWS may have blocked the IP and they are investigating. In the meantime, my site isn’t working and new users aren’t able to sign up so I just upgraded hosting. Now, with a new IP, it works.
–> Solution to problem: paying $467.64USD :angry:

What kind of site do you run that needs 8MB of ram?

My site is for ESL students/teachers. Gets about 3,000 uniques a day. I have about 200 paying customers and it earns only about $1000 a month, so it’s hard to justify spending a lot. Also, there’s no huge need for performance since the pages are mainly text-based lesson plans.

I’ve got huge downloads (maps). So I have 40-50TB traffic per month via S2 member projected downloas. As I need 4TB data grabs as well I use a 64GB dedicated server (Ryzen 3600). It’s idling along except for the disks that do hard work.
But sometimes could have surges so I just put huge memory potential and see it keeps 6-10GB on hold (but surely could release most if needed
But that server is like 65 euros/month . Hetzner cloud with dedicated IP would be a good solution if not for the needed disk space and related big file traffic.

But again I think you see you really want dedicated own IP and enough RAM. An 8GB RAM cloud share with 2 cores should be less than 12 USD/month with 5TB traffic limit… and on cloud so you can upgrade on the fly if you need more for some hours…

1 Like