## What was reported
Issue stripe/stripe-node#2207 (closed, 18 comments): ### Describe the bug
When installing either the version 17.0.0 or 17.1.0
in a brand new next.js 14 from scratch after initializing stripe
```
import Stripe from 'stripe';
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string, {
apiVersion: '2024-06-20',
typescript: true
})
```
I get the following error: Neither apiKey nor config.authenticator provided
This issue is not seen after downgrading to 16.12.0
### To Reproduce
Create a next.js project
adding stripe version 17.1.0
add a lib folder with a new file stripe.ts
with the following:
```
impor
## The verified resolution
[xavdid-stripe (maintainer)]: Confident the issue stems from the env key not being set during build stages in certain environments even though it's available at runtime. v17 added an explicit null-key check in the constructor, so a null `process.env.STRIPE_SECRET_KEY` now raises this error (older versions silently created a broken client). README updated in PR #2238 with suggestions: initialize stripe lazily, put a placeholder key after the env read, or make the API key available earlier in the build.