Codexdeployment

Codex App Works on My Computer but Fails After Deploy

The app Codex built runs fine on your computer but shows errors on your live site. The usual differences between the two and how to check each.

2 min read Updated Applies to Codex

What is going on

The app Codex built runs fine on your computer. After you put it online, the page is blank, a feature fails, or the host reports a failed build.

The code is the same in both places. What differs is everything around it: settings, versions, the database and how the app is started.

Error messages you might see

Build failed
Module not found
Application error
Cannot connect to database
ECONNREFUSED 127.0.0.1

Common causes

  1. Environment variables or API keys exist in your local .env file but were never added to the hosting service.
  2. The hosting service uses a different version of Node, Python or another runtime than your computer.
  3. The build command or start command in the host settings does not match what you run locally.
  4. The app points at a local database or a local address such as localhost.
  5. File names that differ only by capital letters: this works on a Mac or Windows computer and fails on a Linux server.

How to fix it

  1. Open the host's build log and the runtime log. The first error line usually names the cause.
  2. Compare the list of environment variables in the host with the ones in your local .env file. Add anything missing.
  3. Set the same runtime version in the host as on your computer.
  4. Check that the build and start commands in the host match what you run locally.
  5. Search the code for localhost and fixed addresses, and replace them with settings.
  6. Check capital letters in file names and imports.

Getting help takes about a minute

No hiring, no back and forth. A real person looks at your app.

  1. 1

    Describe it

    Tell us what you need in plain words. You don't have to be technical or have an account to start.

  2. 2

    Free 15-minute call

    A verified developer calls you. Many tasks are sorted right there, and it costs nothing.

  3. 3

    Pay after you approve

    If there is more to do, you get one fixed price up front. You pay only once you are happy.

Get help

Real people, reviewed by hand

Developers who do this every day

Every developer is approved by our team before they can take a task. Describe yours and the first one who is free picks it up.

Get help

Questions

Why does it work locally but not online?

Your computer and the host differ in settings, versions and the database. Almost every case comes down to one of those three.

Where do I find the real error?

In the host's build log and runtime log, not in the page you see in the browser.

Keep reading

Can't fix it yourself?
Real developers can help.

Get help