#paul-geoghegan_error

1 messages ¡ Page 1 of 1 (latest)

bold deltaBOT
#

👋 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/1266126356845166592

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

shell kilnBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

stray tendon
#

It is related to both of those but I managed to replicate the problem on my local machine and log the response from stripe.

chrome tangle
stray tendon
#

It actually doesn't have one: const paymentIntentPayload = {
amount: total * 100,
currency: 'eur',
description: Order number: ${orderNumber},
automatic_payment_methods: {
enabled: true
}
};
console.log('Creating payment intent with payload:', paymentIntentPayload);

    const paymentIntent =
        await stripe.paymentIntents.create(paymentIntentPayload);
#

StripeError raw: {
message: "Invalid JSON received from the Stripe API",
exception: 91 | response += chunk;
92 | });
93 | this._res.once('end', () => {
94 | try {
95 | console.log('response', response);
96 | resolve(JSON.parse(response));
^
SyntaxError: JSON Parse error: Unrecognized token '<'
at <parse> ()
at parse (native:1:1)
at C:\Users\mrpau\OneDrive\Dokumenter\GitHub\Take-the-Cake-Website\node_modules\stripe\esm\net\NodeHttpClient.js:96:34
at node:events:33:26
at emit (node:events:180:48)
at endReadableNT (node:stream:2507:27)
,
requestId: undefined,
}

chrome tangle
#

Can you paste the exact error you're seeing?

#

I see it

#

Thank you

#

I see a similar report when using Bun: https://github.com/oven-sh/bun/issues/10975 which was resolved by adding '--conditions=worker'. It is odd that it works in dev server and not in build server. The above issue indicates that there is a bug on http/https implementation. I'm still looking

stray tendon
#

I asked in their server and haven't heard anything yet. I'll try the fix for bun now.

bold deltaBOT
stray tendon
#

No, I tried that and I got the same response.

crisp sedge
#

Hello, trying to catch up. Is that 403 HTML page coming back from Stripe after you send us something? I have not seen us error like that before.

#

Or I guess, how exactly are you accessing that response?

stray tendon
#

Yes, I'm trying to make a payment intent and that's what I'm getting back.

#

I printed that response by adding a console.log inside node_modules/stripe/net/NodeHttpClient.js on line 96 before it tries to parse the json response.

crisp sedge
#

Gotcha, I am not sure what this may be, reaching out to my colleagues and will get back with what we can find.

stray tendon
#

Perfect thanks so much. It has delayed the launch of a new site for 3 days so any help would be great.

#

Would it be worth my time trying the request with axios instead to see if it is an issue with the stripe NPM package?

crisp sedge
#

Yeah if you can try making the same request with something else, that could help narrow down what is happening here

#

And do you know what broadly the differences are between dev and build here? And are there any differences in how your code sets up the stripe client based on dev vs build?

stray tendon
#

I'm not super famileir with how Sveltekit works behind the scenes but it pretty much just optomises all of the code and compiles it in to one big build folder with as many things as possable staticly rendered. No there is nothing different in my code for build vs dev.

#

Using axios to send the post request did not fix the issue

crisp sedge
#

Interesting, so it is a different in how HTTP(S) requests are made in that environment in general?

stray tendon
#

No, I don't think so. I'm making many other api/database calls and they all work fine.

#

Is there a way that I could work around this? I need to get the users address and email back from stripe though so I don't think I can just embed the checkout right?

#

I just really need to get this site up so any solution is better than no solution.

crisp sedge
#

Embed the checkout as in put the Payment Element within an iframe? Or something else?

stray tendon
#

I'm not sure. I thought you could somehow embed a checkout instead of using payment elements.

crisp sedge
stray tendon
#

Okay, then that probably wouldn't fix it.

#

I tried it on my production server and I got the same issue. I'm using Nginx. Is there anything I can do to make it use https for the Stripe request. It is using https for inbound traffic. It's just a test server but here is the link if you want it: https://takethecake.envisionly.tech/

bold deltaBOT
crisp sedge
#

I am still trying to figure out the underlying issue here. So to be clear as far as you know is your backend that you are making this stripe-node call on just a standard node setup? Would it be possible to send us a small node project to run that reproduces this? I think we may need to file this with the people who make our node library

stray tendon
#

I'm actually using bun but I'm about to try it on node.

crisp sedge
#

Gotcha, I'd say file another issue with bun. It sounds like there may still be some issue with the underlying node:http implementation that they use. If you can switch backends to use stripe-node with node that sounds like it may be a great solution

stray tendon
#

I'll try it now. That way we can tell if bun is the issue.

stray tendon
#

Yes, Bun was the issue.

unborn maple
#

Wow!

#

Thanks for testing this out

#

(Pompey had to run)

stray tendon
#

That's fine don't worry. No thank you for your help. You have saved me!

#

As far as the bun issue said I think it is an issue with the Stripe package but I don't care if I can get it to work.

unborn maple
stray tendon
#

I think that resolved the issue that was mentioned in the issue created in May but my issue seems to be different somehow.

#

The temporary fix proposed in the issue didn't work for me so I think it's different.

unborn maple
#

I see

stray tendon
#

I just commented there. Hopefuly they can get that fixed.