Skip to content

fix(stripe): correct Stripe secret environment variable typo#7

Closed
Yuankai619 wants to merge 1 commit into
demofrom
corvo/fix/stripe-channel-secret-fix-0o85rqsbrm37a
Closed

fix(stripe): correct Stripe secret environment variable typo#7
Yuankai619 wants to merge 1 commit into
demofrom
corvo/fix/stripe-channel-secret-fix-0o85rqsbrm37a

Conversation

@Yuankai619

Copy link
Copy Markdown
Member

What does this PR do?

This PR corrects a spelling typo in the Stripe API secret key environment variable name. It changes process.env.Stripe_CHANEL_SECRET (with one 'L') to process.env.Stripe_CHANNEL_SECRET (with two 'L's) in both the Stripe client helper initialization (lib/stripe.ts) and the mock key check inside the payment API endpoint (app/api/checkout/payment/route.ts).

Why is this change needed?

At runtime, the Stripe initialization failed with the error Neither apiKey nor config.authenticator provided because the deployed environment variable on Cloud Run is named Stripe_CHANNEL_SECRET. Since the code was looking for Stripe_CHANEL_SECRET, it received undefined, causing the Stripe client instantiation to fail.

  • Incident: 0.o85rqsbrm37a
  • Alert: Ticket flow error alert(dev)
  • Triggered at: 2026-05-22T17:19:16.000Z
  • Root cause: Typo in variable name Stripe_CHANEL_SECRET (should be Stripe_CHANNEL_SECRET) resulting in a failure to initialize Stripe client.

How was this change tested?

  • Manual verification of code changes and comparison with environment variables on Cloud Run.
  • Verified correct spelling matches .env.production.example and deployment pipeline configs.

What should reviewers focus on?

Reviewers should verify that the correct environment variable name on other deployment targets or local .env is indeed Stripe_CHANNEL_SECRET to ensure compatibility.

Out of scope

No structural changes or payment logic changes were introduced.

Generated by

🤖 Corvo Agent — investigation traced to commit 750e214e131e5d5547d15c51b7c11981840f1a52e5e63293ef14b458aadeac24a0ac83f8f1737ce87a801368bf0bbe0cf8a18684d3ecad9532a9bbd53d62fc1ae51cd07f2bc403426c8f2026b9ebc0e6aa5bf00 (which introduced the Stripe_CHANEL_SECRET spelling).

The application was using Stripe_CHANEL_SECRET to fetch the Stripe API secret key, resulting in undefined when trying to instantiate the Stripe client. Correcting the environment variable to Stripe_CHANNEL_SECRET resolves the issue by matching the actual env var configured in Cloud Run.

Co-Authored-By: Corvo Agent <noreply@corvo.dev>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request corrects a typo in the environment variable name, changing Stripe_CHANEL_SECRET to Stripe_CHANNEL_SECRET in both the payment API route and the Stripe utility library. The reviewer recommended adding explicit validation for this environment variable in lib/stripe.ts to throw a clear error if it is missing, which improves robustness and simplifies debugging.

Comment thread lib/stripe.ts
export function getStripe(): Stripe {
if (!_stripe) {
const stripeSecretKey = process.env.Stripe_CHANEL_SECRET;
const stripeSecretKey = process.env.Stripe_CHANNEL_SECRET;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve robustness and follow defensive programming practices, we should explicitly validate that the Stripe_CHANNEL_SECRET environment variable is defined. Throwing a clear error early makes debugging configuration issues much easier than letting the Stripe client fail with a generic initialization error.

Suggested change
const stripeSecretKey = process.env.Stripe_CHANNEL_SECRET;
const stripeSecretKey = process.env.Stripe_CHANNEL_SECRET;
if (!stripeSecretKey) {
throw new Error('Missing Stripe_CHANNEL_SECRET environment variable');
}

@Yuankai619 Yuankai619 closed this Jun 8, 2026
@Yuankai619 Yuankai619 deleted the corvo/fix/stripe-channel-secret-fix-0o85rqsbrm37a branch June 8, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant