bobthecow / genghis

The single-file MongoDB admin app
http://genghisapp.com
MIT License
1.45k stars 163 forks source link

Any error logging? #147

Open rtorcato opened 11 years ago

rtorcato commented 11 years ago

I have it installed on mamp and i see no errors in the error logs.

Genghis displays: FAIL An unexpected server error has occurred.

How can i get a more detailed reason for what went wrong.

bobthecow commented 11 years ago

Post a screenshot?

rtorcato commented 11 years ago

screen shot 2013-12-03 at 12 39 04 pm

bobthecow commented 11 years ago

Wow. I don't think I've ever actually seen that alert actually show up.

It's a fallback for a fallback error message:

try {
    data = JSON.parse(response.responseText);
} catch (e) {
    data = {error: response.responseText};
}
msg = data.error || '<strong>FAIL</strong> An unexpected server error has occurred.';

This means that not only did your server not return what Genghis was expecting, but it didn't return anything at all, so there's not a more helpful message for Genghis to display.

rtorcato commented 11 years ago

lol ok i will go and see what my server error level is

bobthecow commented 11 years ago

Do you mind checking in dev tools to see what URL it was requesting when it ran into that? That might help track it down as well.

rtorcato commented 11 years ago

what dev tools? There is no javascript errors.

my error level is set to: E_ALL & ~E_NOTICE

bobthecow commented 11 years ago

The "Timeline" or "Net" tab of Inspector, or Console, or Firebug, or whatever your browser has. Just check what URL was requested that didn't return 200 OK.

rtorcato commented 11 years ago

screen shot 2013-12-03 at 1 10 12 pm

bobthecow commented 11 years ago

It looks like you're using the 3.0 dev branch, right? Are you running genghis.php or genghis-dev.php?

rtorcato commented 11 years ago

yes i tried the dev branch to see if my error would go away

bobthecow commented 11 years ago

Never mind, I can tell from the screenshot you just posted. Are you using rewrite rules? Are you running this on its own virtual host, or in a folder?

rtorcato commented 11 years ago

most likely this issue is same as what i had before on my amazon lamp stack. using the new mongoclient http://derickrethans.nl/mongoclient.html

bobthecow commented 11 years ago

Genghis should support both with and without MongoClient.

rtorcato commented 11 years ago

it's just running in a folder. No change to rewrite .

bobthecow commented 11 years ago

https://github.com/bobthecow/genghis/tree/develop <- that is the dev branch.

https://github.com/bobthecow/genghis/tree/feature/three-dot-oh-my <- that is a very much work-in-progress 3.0 dev branch.

For now, you probably want the first one, not the second :)

rtorcato commented 11 years ago

ok grabbed the first link and updated htaccess file with no success.

bobthecow commented 11 years ago

One of the two URLs that's failing for you is check-status, an API call that does a couple of environment sanity checks. It doesn't do anything crazy at all, just check for Mongo drivers, timezone issues, magic quote config, etc:

https://github.com/bobthecow/genghis/blob/feature/three-dot-oh-my/src/php/Genghis/Api.php#L96-L171

So that shouldn't be MongoClient related.

bobthecow commented 11 years ago

If the other dev version didn't work for you, it's probably environment related. What version of MAMP are you running?

rtorcato commented 11 years ago

Version 2.0.5 (2.0.5)

rtorcato commented 11 years ago

php 5.3.6

bobthecow commented 11 years ago

Okay. Lemme see if I can reproduce it.

rtorcato commented 11 years ago

it might be easier to debug if you installed this with genghis http://filp.github.io/whoops/demo/

Laravel framework has whoops included.

if I went to http://localhost/genghis/check-status in my browser should that be displaying a 404 error or json response?

bobthecow commented 11 years ago

I love whoops :)

For the non-dev releases (i.e. the compiled genghis.php) it would be just about worthless though. Might make sense to include it in genghis-dev.php for 3.0+ though. I'll look into it.

bobthecow commented 11 years ago

/check-status would return 404 if you hit it in a browser.

Most Genghis paths respond to two kinds of requests: for standard browser requests, they respond with an HTML page. For XHR requests, they respond as a JSON API. For example, /servers/localhost is usually a page with a list of servers on it. But if you request it as XHR with Accept: application/json, it will return the JSON representation of that list of servers.

/check-status doesn't respond to the regular HTML request, however. It's one of the few endpoints that's XHR/JSON only. It wouldn't be a bad idea to make it a sort of debugging page though. I'll look into that for 3.0+ too :)

bobthecow commented 11 years ago

Okay. The good news is that I was able to reproduce this. The bad news is that I'm not exactly sure what it's doing :)

I'll keep looking.

bobthecow commented 11 years ago

You're sure you're not getting any errors in your MAMP logs? Mine is missing the Mongo class (I haven't installed the Mongo extension in MAMP yet) but the error shows up in logs/php_error.log

rtorcato commented 11 years ago

nope nothing in my error logs.

bobthecow commented 11 years ago

And you have the Mongo extension installed and working?

rtorcato commented 11 years ago

yep it works. I have it working with codeigniter and i also have mongo working with a laravel site I just started.

bobthecow commented 10 years ago

Just for fun, try out the latest version?

rtorcato commented 10 years ago

sorry no change

bobthecow commented 10 years ago

Ok. I'll look into it further when I get a chance.