Creator

Troubleshooting

Common errors and their fixes.

"DATABASE_URL is not set"

The database client in lib/db/index.ts throws this if DATABASE_URL is missing.

Fix: Add DATABASE_URL to your .env.local file:

DATABASE_URL="postgresql://user:password@host:5432/dbname"

"STRIPESECRET_KEY is not defined"

The Stripe service throws at startup if NEXT_STRIPE_SECRET_KEY is not set.

Fix: If you're using Stripe, add the key. If you're using Lemon Squeezy, this error occurs because the Stripe service file is still imported. You can ignore it in development by setting a placeholder value, or remove the Stripe import from files that don't need it.

Migrations fail with connection error

Drizzle Kit loads environment variables from .env.local (configured in drizzle.config.ts). If your variables are in a different file, it won't find them.

Fix: Make sure your DATABASE_URL is in .env.local, or update the dotenv.config({ path: ".env.local" }) line in drizzle.config.ts.

"User already exists with this email"

Returned by POST /api/auth/register when trying to register with an email that's already in the database and verified.

Fix: Use a different email, or log in with the existing account. If the existing user was created via OAuth, you can log in with that provider.

OAuth login returns to login page without error

This can happen when:

  1. OAuth credentials are wrong — verify AUTH_GOOGLE_ID/AUTH_GOOGLE_SECRET or AUTH_GITHUB_ID/AUTH_GITHUB_SECRET
  2. The callback URL doesn't match — add {your-domain}/api/auth/callback/google (or /github) to your OAuth app's authorized redirect URIs
  3. allowSignup is false and the user doesn't exist — the signIn callback silently blocks new OAuth users

Fix: Check your OAuth provider's console for the correct callback URL and ensure credentials match.

"Registration is disabled"

The register API returns 403 when appConfig.allowSignup is false.

Fix: Set allowSignup: true in config/app.config.ts if you want to allow new registrations.

Email not sending (Resend)

Common causes:

  1. Using onboarding@resend.dev as the from address — this only works for testing and delivers to the Resend dashboard, not to real inboxes
  2. API key is invalid or expired
  3. Domain is not verified in Resend dashboard

Fix: For testing, check the Resend dashboard for delivered emails. For production, verify your domain and update NEXT_RESEND_FROM_EMAIL to an email on your verified domain.

"Unknown email service" or "Unknown storage service"

The factory functions in email-service.ts and storage-service.ts throw this when NEXT_PUBLIC_EMAIL_SERVICE or NEXT_PUBLIC_STORAGE_SERVICE has an unrecognized value.

Fix: Set to one of the supported values:

  • Email: "resend" or "mailgun"
  • Storage: "r2" or "supabase"

Webhook signature verification failed

Both Stripe and Lemon Squeezy webhooks verify signatures before processing.

Fix:

  • Stripe: Verify NEXT_STRIPE_WEBHOOK_SECRET matches the signing secret from Stripe dashboard. For local development, use stripe listen --forward-to localhost:3000/api/stripe/webhook
  • Lemon Squeezy: Verify LEMONSQUEEZY_WEBHOOK_SECRET matches the secret set in the LS dashboard

Rate limiting not working

Rate limiting requires Upstash Redis. If the environment variables are missing, the Ratelimit constructor will throw.

Fix: Set up an Upstash Redis database and add credentials:

UPSTASH_REDIS_REST_URL=""
UPSTASH_REDIS_REST_TOKEN=""

"prepare is not supported for Transaction pool mode"

This error comes from postgres.js when using a database with transaction pooling enabled.

Fix: Already handled — lib/db/index.ts sets prepare: false. If you see this error, make sure you're importing db from lib/db/index.ts and not creating a new postgres client elsewhere.

Build fails with Sentry errors

If Sentry source map upload fails during build:

Fix: Either set all Sentry environment variables (SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT) or leave them all empty. The withSentryConfig wrapper in next.config.ts has silent: true which suppresses most warnings, but missing partial config can still cause issues.

On this page

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.