#dominik_error

1 messages ยท Page 1 of 1 (latest)

normal vaporBOT
#

๐Ÿ‘‹ 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.

soft thorn
#

To clarify things further im using nextjs 14.2.3 and stripe 15.8.0

lyric ravine
#

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?

soft thorn
#

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

lyric ravine
#

But you say that works in some environments?

soft thorn
#

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

lyric ravine
#

So what is changing when you put it in a container? What's different between your containerized environment and your local one?

soft thorn
#

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

lyric ravine
#

Hm, I'm also confused, because I'm not finding that error message in our library.

soft thorn
#

Im also using @stripe/stripe-js maybe it comes from that

lyric ravine
#

Do you have logging to check exactly what line is throwing the error in your codebase?

soft thorn
#

No sadly not, it could perhaps also be this function from stripe-js

    const stripePromise = loadStripe(
      process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!
    );
lyric ravine
#

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.

soft thorn
#

Yea I verified its indeed that line above causing the issues. for some reason "NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY" is undefined