Why does my app work locally but break after deployment?
Environment differences
Your local setup often has settings that the production server does not. Secrets, database URLs and API keys may be defined in a local file that never gets uploaded. Check that every required variable is set on the host with the correct value.
Version mismatches cause trouble too. An AI tool may generate code that depends on a newer runtime than the one your host uses. Match the versions in your deployment settings to what you tested locally. Mismatched versions are easy to miss when the tests only run locally.
Checking the deploy logs
Open the build and runtime logs on your hosting dashboard. The first error in the log usually points to the real problem, while later errors are often side effects. Copy the exact message into your prompt so the AI can focus on it.
Hard-coded paths such as a local folder name or localhost address will also fail on a server. Search the code for localhost and absolute paths before you deploy.
- Compare environment variables between local and host.
- Match Node or Python versions to your settings.
- Search for hard-coded localhost addresses.
- Read the first error in the build log.
Common mistakes
- Changing code repeatedly without reading the first error in the deploy log.
- Uploading a local settings file that contains real secrets.
