#Arctic - next.js

1 messages ยท Page 1 of 1 (latest)

flat rampartBOT
dapper iron
#

Hi ๐Ÿ‘‹
This isn't documentation we maintain AFAIK so we cannot speak to whether it is up to date or not

covert bone
#

okay

dapper iron
#

Yes that should be

covert bone
#

i remember i had a problem with it at work today, but i will try again tomorrow then

#

thank you ๐Ÿ‘

dapper iron
#

I hope it works out for you. If you have any questions while working through it we will be here

covert bone
#

thanks so much:)

dapper iron
#

Happy to help ๐Ÿ™‚

#

Arctic - next.js

covert bone
#
{
  "error": {
    "message": "Invalid API Key provided: undefined",
    "type": "invalid_request_error"
  }
}```
#

but i have the api key defined

dapper iron
#

Okay, how are you instantiating the Stripe client?

covert bone
#
const stripePromise = loadStripe(
  `${process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}`
)```
#

like this in my index file

#

and then passing it in elements as described in the guide

        <Elements options={options} stripe={stripePromise}>
          <CheckoutForm />
        </Elements>
dapper iron
#

Okay so the error is stating the value passed in on loadStripe is undefined. Can you try first assigning that to a variable and logging the value?

covert bone
#

okay

#

ohh, i have another stripe test project open in the same editor and was changing the .env file for the wrong project ๐Ÿ˜…

#

so sorry, my head is a little fried, now the api calls are going through:)

dapper iron
#

๐ŸŽ‰ Happy to hear it

covert bone
#

got further than at work today :p

#

and payment succeeded, great thanks again

dapper iron
#

Happy to help ๐Ÿ™‚

covert bone
#

also, you might want to change this in the guide

const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY);

to this

const stripePromise = loadStripe(
  `${process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}`
)```
#

without the `` it was throwing an error for me that the value needs to be a string

dapper iron
#

Interesting. i thought the process.env did return a string

covert bone
#

ive seen a few cases online where people had this error without the ``

cold widget
#

Do you have examples of those issues online? I'm really curious under what circumstances process.env.SOME_KEY does not evaluate to a String

cold widget
#

What is the value type without the ''? Like, what does process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY evaluate to if not a string?

covert bone
#

thats why its confusing xD

#

ill look up the stackoverflow thread tomorrow at work pc and send it in here, maybe theres something helpfull

cold widget
#

That's super confusing. Yeah, feel free to let us know. I'm also curious what the actual error is.

covert bone
#

have that on the work pc aswell