#lighthorse_webhooks

1 messages ยท Page 1 of 1 (latest)

copper templeBOT
#

๐Ÿ‘‹ 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/1369684440657297458

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

vivid horizon
#

Hello, can you tell me more about what you mean by "updates in Stripe to land back on the server so I can update my UI". Are you saying that certain events are not being sent to a specific webhook endpoint? Or something else?

tropic bison
#

yes exactly

#

Thanks for getting back so quickly

#
  1. I update a customers subscription: specifically the product/price
  2. This should then be picked up by my server.js, but i'm not getting any indication that the server is hearing anything at all.
vivid horizon
#

Is that event that you provided an example of an event that your server code isn't picking up? From our logs I can see that it was sent to a CLI endpoint as well as the live endpoint that you have

#

We even got a 200 success response code back from the live webhook endpoint

tropic bison
#

I'll try another one, to be sure. one moment please

#

evt_1RM9D0EBwSjyueqK1nf3hh4W

#

This one didn't work on my UI, either

#

The webhook "sproutscientific" is for a different purpose/site and unrelated

#

Thank you in advance for your help

vivid horizon
#

Interesting. In our logs I do see the event being sent to two CLI endpoints. Can you stop your current CLI listener, re-run it with --log-level=debug, send another event, and see if the CLI outputs anything?

tropic bison
#

ok, so i am running it in vscode's powershell, using this:

stripe listen --forward-to localhost:3000/webhook/stripe

#

so i will cancel it and then do

stripe listen --forward-to localhost:3000/webhook/stripe --log-level=debug ?

#

Also, when im in the "add new local webhook" screen, i noticed that stage 2 doesn't seem to come up as complete:

Is there something to that?

#

okay... i restarted cli with this stripe listen --forward-to localhost:3000/webhook/stripe --log-level=debug

and then changed a subscription... nothing in log for cli nor server...

#

but running this: stripe trigger customer.subscription.updated

I get 200's from the CLI and Webhooks received from the server

vivid horizon
#

Can you send me the ID of the subscription that you changed? (sub_123)

tropic bison
#

sub_1RM0ABEBwSjyueqKTiqeq2rq

vivid horizon
#

Thank you, and can you also send the ID of one of the events from the CLI trigger command that your listener did see?

tropic bison
#

I just searched for the customer from that trigger command and it says that customer is in Test Mode....

#

is that what the problem is maybe?

#

I can go into Test Mode to grab the event ID if it's helpful still?

vivid horizon
tropic bison
#

right, ok, so all i need to do is rerun the CLI in live?

vivid horizon
#

I think so yes

tropic bison
#

trying now thanks

#

no.... still no luck...

#

ill try and run the trigger with the live flag as well?

#

running the trigger didn't seem to take the --live flag

vivid horizon
#

Yes please, maybe just try customer.created and if you can send me the text of the cus_123 ID that that creates. Then I'll compare logs with the event that didn't reach your endpoint

tropic bison
#

CLI says:

2025-05-08 01:20:23 --> customer.created [evt_1RM9liEBwSjyueqKUSFYOzSt]
2025-05-08 01:20:23 <-- [200] POST http://localhost:3000/webhook/stripe [evt_1RM9liEBwSjyueqKUSFYOzSt]

Server says:

โœ… Webhook received: customer.created

PS C:\Users\rhysc\grant-collect\src\clientcollect> stripe trigger customer.created
Setting up fixture for: customer
Running fixture for: customer
Trigger succeeded! Check dashboard for event details.

#

evt_1RM9nJEBwSjyueqKJnx50Aut

#

There is the event: [evt_1RM9nJEBwSjyueqKJnx50Aut]

#

When I search the event, it says it found it in Test mode.....

#

Do i need to give the trigger a --live flag too? I couldn't get that to work

vivid horizon
#

Whoops, looks like trigger only works in test mode.

#

Taking another look at your endpoint configs

tropic bison
#

I've just tried adding console.dir(event.data.object, { depth: null }); after event = stripe.webhooks.constructEvent(
req.body, sig, process.env.STRIPE_WEBHOOK_SECRET
);

... to see if there is any payload coming in

#

... nothing

vivid horizon
#

So to recap, even with this live mode flag, when you actually do something in your live mode dashboard, nothing actually appears in the CLI and your server code never gets triggered?

tropic bison
#

That's correct yes

#

The --live flag is applied to the listen command on the CLI

#

like so:

vivid horizon
#

When I look at your account logs, I am not seeing any recent dashboard actions

#

I think that things may be happening on two separate accounts

tropic bison
#

oh, you think i am logged into the CLI on the wrong account??

vivid horizon
#

That is my guess because the account that owns the event IDs that you have sent has not been modifying objects in live mode recently

tropic bison
#

but im doing everything in the Stripe UI for the account?

vivid horizon
#

Emails can be connected to multiple Stirpe accounts

tropic bison
#

right

vivid horizon
#

If you click in the upper right of your dashboard there may be a dropdown where you can choose between a couple that your email is connected to

#

Also I removed that email message because sometimes bots crawl public discords for addresses to spam, but I noted it for future reference

tropic bison
#

thanks.

#

it looks like the CLI installed with correct account

vivid horizon
#

Can you send me the text of the ID of the customer from that latest screenshot? I can't seem to type it out correctly

tropic bison
#

cus_SGS1xP3mApn5RB

#

also i just checked and account ID checks out with the CLI install

vivid horizon
#

Okay, now I do see those calls in your log. I may have been looking at the wrong account before, my apologies. I'm not immediately seeing why this isn't lining up

copper templeBOT
tropic bison
#

should i start pasting my server code or something? I'm also using another script Stripe.js as a helper that could be breaking things?

#

Hi timebox thanks for joining and for assisting

quick crag
#

Hi hi! I'll actually be taking over for my colleague. Can you give me a quick summary of the issue?

vivid horizon
#

They are trying to listen to live mode events with the CLI (using the --live flag). They are making modifications to customers and subsciptions in their dashboard, but the events aren't showing up in the CLI listener endpoint

#

I don't think the issue is your code, so you can hold off on that for the moment it looks like the events are still only being sent to test mode listeners, I am not sure why

tropic bison
#

can you see the thread history timebox?

quick crag
#

I can, yes. There are currently five conversations happening here, so I will give this a read as soon as I can.

tropic bison
#

Many thanks!

quick crag
#

Can you run stripe --version for me please?

tropic bison
#

stripe version 1.27.0
PS C:\Users\rhysc\grant-collect\src\clientcollect>

quick crag
#

Ok cool me too.

#

What happens if you just run stripe listen --live and then create something in livemode?

tropic bison
#

when you say create something in live mode, do you mean making a change in the Stripe UI??

#

Ok, I ran that, and changed a subscription and this did return:

PS C:\Users\rhysc\grant-collect\src\clientcollect> stripe listen --live

Ready! You are using Stripe API Version [2018-10-31]. Your webhook signing secret is whsec_woX6WeJ6O3pT6oTytX9rARum0Rb0eS5o (^C to quit)
2025-05-08 02:50:24 --> customer.subscription.updated [evt_1RMBApEBwSjyueqKBuINVSq5]

#

But nothing returned in the server

#

I guess that's because it was not being forwarded

quick crag
#

Right, but it got received by Stripe CLI - we just proved that.

tropic bison
#

yep, nice going

#

im wondering if the --live tag hasn't been working when i do stripe listen --forward-to localhost:3000/webhook/stripe --live

quick crag
#

Can you make a simple server that does nothing but print out whatever it receives, and then run that and forward to it?

tropic bison
#

yes i can probably do that

#

Something like this?

const http = require('http');

const server = http.createServer((req, res) => {
console.log(\n[${new Date().toISOString()}] ${req.method} ${req.url});

console.log('Headers:', req.headers);

let bodyChunks = [];
req.on('data', chunk => bodyChunks.push(chunk));
req.on('end', () => {
const body = Buffer.concat(bodyChunks).toString();
if (body) {
console.log('Body:\n', body);
} else {
console.log('(no body)');
}

// Simple 200 OK response
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('OK\n');

});
});

const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
console.log(Test server listening on http://localhost:${PORT});
});

#

yes ok its running.

#

timebox

#

I have no idea what i've changed to get this to work, but it's working

#

The thing the only think I changed is removing one space before the --live call:

from
stripe listen --forward-to localhost:3000/webhook/stripe --live
to
stripe listen --forward-to localhost:3000/webhook/stripe --live

#

Could that really have been it?

copper templeBOT
quick crag
#

Oh wow. That totally could have been it. Commandlines can be finnicky.

tropic bison
#

What is my life ๐Ÿ˜†

#

Thanks, I should be able to take it from here. Appreciate you!