#dominik_error
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1246104665716686994
๐ Have more to share? Add details, code, screenshots, videos, etc. below.
To clarify things further im using nextjs 14.2.3 and stripe 15.8.0
Hi there ๐ I don't know why that error would be thrown in only a specific environment, I'd expect it to be thrown whenever a kay either isn't provided or isn't a string. Do you have more context on how you're doing things that you can share?
I tried
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
apiVersion: "2024-04-10",
});
export const stripe = new Stripe(`${process.env.STRIPE_SECRET_KEY!}`, {
apiVersion: "2024-04-10",
});
export const stripe = new Stripe("hidden", {
apiVersion: "2024-04-10",
});
so far
all 3 of them throw the same error
even tho the stripe token is a string and not undefined in all 3
But you say that works in some environments?
It works totally fine when I run it on my dev server but the second I use docker for the production version it claims its not a string anymore
So what is changing when you put it in a container? What's different between your containerized environment and your local one?
The port it runs on is basically the only difference
Which is why im confused by stripe telling me its not a string when it very clearly is
Hm, I'm also confused, because I'm not finding that error message in our library.
Im also using @stripe/stripe-js maybe it comes from that
Do you have logging to check exactly what line is throwing the error in your codebase?
No sadly not, it could perhaps also be this function from stripe-js
const stripePromise = loadStripe(
process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!
);
It's hard to say what you should adjust without knowing what is surfacing the error. I'd suggest you start by adding enough logging to your code to be able to spot the exact line that is throwing the error, then we can take a closer look at that line.
Yea I verified its indeed that line above causing the issues. for some reason "NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY" is undefined