directus / v8-archive

Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
https://docs.directus.io/api/reference.html
507 stars 204 forks source link

Request failed with status code 500 #2000

Open Fusseldieb opened 3 years ago

Fusseldieb commented 3 years ago

[Self answer for documentation purposes]

Hi,

I was tinkering with my Directus Tables and whatnot, when Directus suddely errored 500. Since I wasn't sure what I did before it went down, I was clueless. All logs were absent. I could find nothing 'bad' in MySQL logs, nor Apache2 logs, not Directus logs, nor PHP logs. The error was just completely transparent. System logs also didn't say anything. I even restarted the entire server, nothing...

server_ip/server/ping did respond with pong, but when loading the Admin App, it just wrote Something is wrong with this project and Request failed with status code 500.

Something? Something...!

Looking through Chrome's DevKit to see the Network requests, I could see server/ping and project/ failing with error 500 (red) and no "Response" was present.

A guessing game.


Directus 8.8.1

Fusseldieb commented 3 years ago

Turns out, if a hook has invalid code, it brings the whole Directus API down. Silently.

Logs weren't present. Removing the hook or putting two underscores behind the filename like __myhook.php brought the API back to life.

I think I spent at least 2 hours on this...

Leaving the issue open, since lacking Logs are an issue, but I'm really just self-answering my solution for future googlers!