-
Notifications
You must be signed in to change notification settings - Fork 0
fix(stripe): correct Stripe secret key environment variable typo #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: demo
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ let _stripe: Stripe | null = null; | |||||||||||
|
|
||||||||||||
| export function getStripe(): Stripe { | ||||||||||||
| if (!_stripe) { | ||||||||||||
| const stripeSecretKey = process.env.Stripe_CHANEL_SECRET; | ||||||||||||
| const stripeSecretKey = process.env.Stripe_CHANNEL_SECRET || process.env.Stripe_CHANEL_SECRET; | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this change correctly addresses the typo and provides a fallback, the code still relies on a non-null assertion (
Suggested change
|
||||||||||||
| _stripe = new Stripe(stripeSecretKey!, { | ||||||||||||
| apiVersion: '2026-03-25.dahlia', | ||||||||||||
| }); | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for retrieving the Stripe secret key (including the fallback for the legacy typo) is duplicated here and in
lib/stripe.ts. This duplication increases the maintenance burden and the risk of future errors if the environment variable configuration changes again. Consider centralizing this lookup inlib/stripe.tsby exporting the key or a helper function to ensure consistency across the application.