convex-nextjs-dual-environment-secrets

Synchronize INTERNAL_API_SECRET between Next.js .env.local and Convex environment variables.

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/strataga/claude-skill-inception --skill convex-nextjs-dual-environment-secrets
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-nextjs-dual-environment-secrets
Source: https://github.com/strataga/claude-skill-inception/tree/main/convex-nextjs-dual-environment-secrets
Command: npx skills add https://github.com/strataga/claude-skill-inception --skill convex-nextjs-dual-environment-secrets

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Addresses cross-environment secret synchronization between Next.js and Convex to prevent 'Unauthorized' errors in mutations and webhook handlers by ensuring INTERNAL_API_SECRET and related secrets exist in both environments.

Core Features & Use Cases

  • Cross-env secret synchronization ensures Convex and Next.js share identical secrets across environments.
  • Error diagnosis and verification help identify Unauthorized errors caused by missing or mismatched secrets in Convex or Next.js runtime.
  • Deployment-time validation guides applying secret changes to both Next.js (.env.local) and Convex environment variables.
  • Use Case: When a Convex mutation or webhook returns Unauthorized, fix by aligning secrets.

Quick Start

  • Add INTERNAL_API_SECRET to Next.js .env.local and mirror the same value in Convex environment variables.
  • Redeploy or refresh both environments, then trigger a small test mutation to verify authentication succeeds.

Frequently Asked Questions about convex-nextjs-dual-environment-secrets

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Convex webhook return Unauthorized despite having secrets in Next.js?

Your Convex webhook returns Unauthorized because the secrets are missing or mismatched in the Convex environment. Synchronizing secrets ensures both Next.js and Convex share identical values to resolve authentication failures.

How do I sync environment variables between Next.js and Convex?

To sync environment variables, add the INTERNAL_API_SECRET to your Next.js .env.local file and mirror the exact same value in your Convex environment variables. Redeploy both environments to apply the changes.

What causes cross-environment authentication failures in Next.js and Convex?

Cross-environment authentication failures are caused by missing or mismatched secrets between Next.js API routes and Convex mutations. Explicit synchronization requires aligning the INTERNAL_API_SECRET across both local and Convex environments.

How do I verify that secrets are correctly synchronized across Next.js and Convex?

Verify synchronized secrets by redeploying or refreshing both Next.js and Convex environments, then trigger a small test mutation. If the authentication succeeds, the INTERNAL_API_SECRET values match correctly across environments.

Do I need to redeploy Next.js and Convex after updating environment variables?

Yes, you must redeploy or refresh both Next.js and Convex after updating environment variables. Applying secret changes to both environments ensures the new values are loaded before you verify authentication succeeds.