LogicTrail
  • Trails
  • Check my app
  • Pricing
  • Sign in
  1. Trails
  2. /
  3. The life of a click
  4. · 4 minutes · Pro

Works on my machine

Sign-up works perfectly on your laptop. On the , every sign-up fails.

This answers: Why does it work locally but not in production? No coding needed. 3 quick decisions.

  • How a request travels
  • Keys and secrets
  • Debugging without panic

Checking your access…

Why does it work locally but not in production?

The most common cause is a missing . Your .env file exists only on your laptop; production has its own settings. Add the variable in your hosting dashboard, redeploy, and validate required variables at startup so a missing one fails the deploy instead of your users.

Trail of the bug
  1. Browser
  2. Your server
  3. Email service

Breaks at Your server: Production has no API key

How it works

Where your keys end upName it NEXT_PUBLIC_

Your server: private

OPENAI_KEY (secret)

Every visitor's browser: public

Publishable key (meant to be here)
The secret key stays on your server, where visitors can't see it. Only the publishable key, made for browsers, goes out.

Why AI tools write this bug

AI tools add new to your local as they build features, but they cannot add them to your hosting provider, so production quietly falls behind.

How to fix it

  1. Read the production logs for the exact error message.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock

Common questions

Should I commit my .env file so production gets it?
No. It publishes your secrets to everyone with repository access, permanently, in git history.

Related scenarios

  • The save that saved nothingFree · 4 min
  • The key in the bundleFree · 4 min
  • Blocked by CORSPro · 4 min

More on this trail

The life of a click: Follow one button press from the browser to the database and back.

Want someone to look?

We check AI-built apps for this and three other common leaks, in plain English.

Check my app
Sign in

Sign in to walk this one

3 decisions, about 4 minutes, and a prompt to check your own app for the same problem.

Sign in No password. We email you a link.

How to fix it

  1. Read the production logs for the exact error message.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock