#ImRonBarnes - clienterror

1 messages · Page 1 of 1 (latest)

thorn drift
#

Hello, can you send me the URL from that error?

#

It looks like this is something client-side but I want to make sure we didn't send anything wonky

rustic parrot
#

is this what you mean

thorn drift
#

Exactly, thank you

rustic parrot
#

to further explain: my teacher was trying to get us to use netlify but netlify was giving me some weird errors so I decided to just make my own API to do what I needed netlify for.

thorn drift
#

So it looks like that error is coming from stripe.js but I am not immediately sure why. Can you send your code that is getting this error?

rustic parrot
#

I can send some screenshots of all those files

thorn drift
#

Send the actual text please

#

Easier for me to use to reproduce and whatnot

#

You can just send snippets, not full tiles

rustic parrot
#

ok whats the best way to send the text, literally just copy paste?

thorn drift
#

Yep

#

Can surround it by triple backticks : ```

rustic parrot
#

im pretty new to coding in general, much less 'talking' code

thorn drift
#

Then it is formatted like this

rustic parrot
#

what from here do you want copied?

lucid cipher
thorn drift
#

Thank you for catching that!

rustic parrot
#

ill try putting my secret key in line 2 without the process.env and see what happens

thorn drift
#

Sounds good, let us know if that resolves your 401

rustic parrot
#

it did not..

#

could the issue be coming from line 6 where I am parsing over event.body?

thorn drift
#

One thing we might want to try is actually using the loadStripe function that karlekko mentioned

#

I don't think so, that url had confirm in it which means it likely came from your confirmCardPayment call

#

One quick thing to check though:

#

Do you know if your new test actually used your new code with the hard coded public key?

#

Sometimes things need a deploy or whatnot, not sure about your setup but I have seen this trip people up

rustic parrot
#

ill share what I have set up real quick

thorn drift
#

Side question: Why is your secret key in your client side code?

rustic parrot
#

API set up on port 8080 because netlify wasn't working nicely with me

#

I had it in an env file but was trying to narrow down potential issues.

thorn drift
#

Ah gotcha, just making sure because that actually making it client side is very bad news.

Looking in to what else might be happening with this setup

#

Like karlekko said, this looks like it has something to do with your public key setup. Is this page able to make any other Stripe calls?

rustic parrot
#

this isnt for a real project, this is just a local thing I'm not planning on actually publishing

#

now that im looking at it, it appears that most of the content of that API is also on a file called create-payment-intent in my react app

#

and it looks like the publishable key is greyed out in my API, like it isnt being used anywhere

thorn drift
#

Are you still initiating stripe with the secret key like in that screenshot?

#

I am looking through our React example code to see what you might need to do here

rustic parrot
#

i put my secret directly in it just now to try it and it made no difference

#

i can change it back

thorn drift
#

Do that, the secret key is not relevant here. You will only need the publishable key

#

Where are you setting up your ElementsProvider?

rustic parrot
#

elements is inside my index.js

thorn drift
#

Where is your stripePromise defined?

rustic parrot
thorn drift
#

Gotcha, and have you double checked that your publishable key env variable is being populated as you expect there?

rustic parrot
#

how can i confirm that

#

hovering over the REACT_APP_STRIPE_PUBLISHABLE_KEY tells me undefined

thorn drift
#

That sounds promising, can you try hardcoding in the publishable key to check if that helps?

rustic parrot
#

replace that whole process.env.....etc with the publishable key?

thorn drift
#

Yeah, just for this test

#

You can also try figuring out why it is defined and do that, I just wanted to quickly make sure that that is what will work

rustic parrot
#

look right?

thorn drift
#

Yep

rustic parrot
#

you're a wizard

#

a magnificent genius wizard, a hat-trick of brilliance

thorn drift
#

Haha thank you, glad we could identify what is going on. So it sounds like you just need to fix that config and you are golden

rustic parrot
#

so my env file apparently isn't communicating properly ?

thorn drift
#

Hard to say, can you pull other values from it properly?

rustic parrot
#

it's interesting because my issue i had with netlify had to do partly with that env file as well.. So perhaps had that env file been working right, I wouldn't have run into a lot of issues lol

thorn drift
#

Yeah env files can be easy to screw up a number of ways at first. Good luck getting that configured properly!