#burt-cors-error

1 messages · Page 1 of 1 (latest)

worthy zenith
#

Hello! CORS errors happen client-side, the code you share is via stripe-node which happens server-side

#

I think you are likely mixing up 2 completely separate/unrelated things

high rune
#

Okay I see, would you happen to know why I get this error from this line of code though?

#

The actual error is 502 Bad Gateway

worthy zenith
#

I can't tell you unfortunately this could be anything right now

#

You haven't really given me much to go from. I'd recommend adding detailed logs to your code to figure out which part is crashing

high rune
#

Hmmm okay, I was hoping it would be something run into before. I created a node backend for my project using AWS API Gateway, auto-generated from Amplify, and added this snippet of code to the node server portion to integrate a stripe hosted checkout

#

Since the code was auto generated by Amplify and requiring Stripe is the breaking change I was hoping someone had used AWS with Stripe before and received 502

worthy zenith
#

yeah unfortunately those words don't mean much to me 😅

high rune
#

no problem

#

thanks

worthy zenith
#

Overall it shouldn't be too hard for you to debug this by adding logs though

#

my guess: you're doing a redirect server-side but your code client-side does a fetch() and crashes. That's a pure guess but the most likely reason

high rune
#

whoa - that might be it

#

calling fetch() client side but then using a redirect server side to send to stripe checkout won't work?

#

fetch being the post.(/create-checkout-session)

worthy zenith
#

I mean if you do .fetch() it won't work

#

basically if your server redirects you can't do a fetch/call client-side that expects a JSON response

#

so change your client-side code to do a form submit on the whole page

high rune
#

Hmmm okay, but this is still happening without a redirect

#

I have a barebones node server that I am calling .get to and I get a response from the server... then I add stripe to it and I am no longer able to get that response

worthy zenith
#

I unfortunately can't tell you more sorry. You need to debug this, read logs on your server