#zowie_error

1 messages ยท Page 1 of 1 (latest)

peak lodgeBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1283073819321565346

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

shy daggerBOT
lapis stirrup
#

Hi there ๐Ÿ‘‹ can you share the ID of an Event where you're seeing that behavior?

tough arrow
#

Hello! evt_3PxUc6Dip8j4bKN74lql8qi7

lapis stirrup
#

Thank you, taking a look

#

Oh I see, your endpoint is responding with a 401 to the request we send to your server. Have you identified where in your Event handling code the invalid encoding error is being thrown from already?

tough arrow
#

Well that is the problem, I do not receive any logging from my StripeWebhooks.php (which normally i do) so i don't have any error logging from these failing requests. However when the checkout does go through correctly i do see error logging. Could it be a network issue?

#

O i see now this:


Warning: Undefined array key "HTTP_STRIPE_SIGNATURE" in /var/www/html/Web/stripeWebhooks.php on line 25
lapis stirrup
#

Hm, I'm not too sure offhand what it could. It seems to me like there is something on your endpoint that is throwing this invalid encoding error, but I'm not familiar with what you have running on your server so I'm not sure where that could be coming from.

Let me take another look at the event.

tough arrow
#

Yes i understand. The "weirdness" rises in the fact that sometimes it does go through correctly. So that is why the encoding error throws me off as well.

error_reporting(E_ALL);
ini_set('display_errors', 1);

header('Access-Control-Allow-Methods: POST');

require '/var/www/html/Web/upload.php';
require_once '/var/www/html/Web/vendor/autoload.php';

if (getenv('STRIPE_SECRET_KEY_PRODUCTION') && getenv('STRIPE_WEBHOOK_ENDPOINT_PRODUCTION')) {
  error_log("StripeWebHOOKS: Environment vars found on server!!");
} else { # locally
  require '/var/www/html/Web/vendor/autoload.php';
  $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
  $dotenv->load();
}

$stripeSecretKey = getenv('STRIPE_SECRET_KEY_PRODUCTION');
$endpoint_secret = getenv('STRIPE_WEBHOOK_ENDPOINT_PRODUCTION');

$stripe = new \Stripe\StripeClient($stripeSecretKey);

$payload = @file_get_contents('php://input');
$sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
error_log("Stripe-Signature Header: " . $_SERVER['HTTP_STRIPE_SIGNATURE']);
$event = null;

the beginning of my webhook is set up like this if that helps ๐Ÿ™‚

lapis stirrup
#

Do you have a sense of when the response is being sent back to us? Like whether your event handling code starts to execute and then throws that error, or if the framework you're using for your web server is throwing that response before your event handling code starts executing?

tough arrow
#

I am going to look into it. I see that for the request that do go through still an error is thrown in Stripe. There might be somewhere where i respond with an error even tho it is succesfull. Which could have affect on the response of the Webhook.

#

Thank you for giving me a direction to look into

#

As per the 401 error + encoding. That is the response that my server sends back to Stripe why it can not work with it correct?

lapis stirrup
#

Correct. We send the request to your endpoint, and then your server responds to us with a 401.

tough arrow
#

Hm okay, thank you for your help. I am going to look into it a bit more

#

You can close the request. Thank you again