Your server code hit an error it didn't handle while answering the request. A 500 is deliberately vague, a catch-all, so the real error is in the server's logs, not on the page. After a deploy it's most often a setting that never reached the server, a database the server can't reach or that's missing tables, or a file or package that existed on the developer's laptop but not in the build.
What's the problem
The site, or one page of it, shows "500 Internal Server Error" or a generic "something went wrong". It might be every page, or only the ones that touch the database or log you in. Before the deploy, or on the developer's machine, the same pages worked.
Why it happens
- The error is hidden on purpose. In production, frameworks show visitors a plain 500 page rather than the technical details, so they don't leak how the app works. The details go to the logs.
- A setting is missing. A database address, an API key or a secret that the code reads when the page loads. On the server it's blank, the code fails, and you get a 500.
- The database isn't what the code expects. It can't be reached from the server, or the tables the new code needs haven't been created yet.
- Production isn't development. A different database engine, a different operating system or a different version of a package. Small differences are enough to break code that worked locally.
How to fix it
- Open the server logs in your host's dashboard and reload the broken page. A new error, usually with a file name and line number, will appear. That's your real problem.
- If the error names a missing value, add that environment variable on the host and restart.
- If it names the database (connection refused, relation or table doesn't exist), check the database is reachable from the server and run the project's migrations.
- If it started with the last deploy, redeploy the previous version to get the site back while you fix it. Most hosting platforms let you do this from the dashboard.
- Reproduce it locally with the production build and production-like settings, then fix it there.
When to call Preventionlabs
A 500 with a clear log line is usually a quick fix. Call us when the logs are empty or meaningless, the errors move around every time one is fixed, or nobody left understands the code well enough to read them. Getting the app running, with the user flows you list working end to end in your own hosting account, is the first thing a resurrection delivers.
Submit your project for a free assessmentFree assessment. $10,000 AUD flat to get it live, only if we take it on and you go ahead.
Sources
- MDN Web Docs: 500 Internal Server Errorweb reference
The HTTP 500 Internal Server Error server error response status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
- MDN Web Docs: 500 Internal Server Errorweb reference
This error is a generic "catch-all" response to server issues, indicating that the server cannot find a more appropriate 5XX error to respond with.
- The Twelve-Factor App: X. Dev/prod parityengineering methodology
Differences between backing services mean that tiny incompatibilities crop up, causing code that worked and passed tests in development or staging to fail in production.