#mike_error
1 messages ยท Page 1 of 1 (latest)
๐ 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/1298087220397342813
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! can you log process.env.STRIPE_SECRET_KEY just before const stripeCustomer = await stripe.customers.create to see what is output?
don't paste the secret key here, we just want to be sure that there actually is a correct value in process.env.STRIPE_SECRET_KEY
Yea i get the key
I was thinking about that to, But I do get the key and it does create the account on stripe. It just spits that error in the terminal.
i guess the other point to check is if that's actually the correct place that the error is originating from? what if you hardcode the secret key instead of reading from the env variable, does the error message go away?
The error message does not go away
would there be another way that you suggest to create the users account? Or would this just be a stripe issue?
I do have it setup like
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY);
this definitely isn't a stripe issue, i tried your code and it works fine for me. I'm wondering if the error is actually occurring at the snippet of code that you shared.
I'm a bit confused as to what you're trying to do though, if you're using the same secret key as when you initialize stripe, why are you also defining the apiKey when creating a Customer?
If I dont add apiKey when trying to create the customer, it just wont create the customer with the error..
if i understand correctly, do you mean the customer won't be created and it'll throw that same error?
correct, if I add the apiKey it will create the customer and throw the error. If I dont add it, it will just throw the error without creating the customer
then the issue is elsewhere and not at that section of code. Can you share the full stack trace of that error?
slight correction, remove the below section and share the full stack trace of that error
{
apiKey: process.env.STRIPE_SECRET_KEY,
}
heres the full error
Can you try to replace everywhere where you need the secret key with a hardcoded stripe secret key? If that works, that means somewhere, your key isn't being loaded as you expect or possibly doesn't exist
if that still doesn't work, then share with me an example (remember to omit your secret key) that replicates the issue using code like JSFiddle, CodeSandbox, or Glitch. Without being able to see the full code, it's really difficult to troubleshoot