CartoDB-SQL-API icon indicating copy to clipboard operation
CartoDB-SQL-API copied to clipboard

Hint about restore_redis script on missing redis metadata

Open strk opened this issue 11 years ago • 8 comments

When user metadata isn't found in redis it would be nice to log an hint about running restore_redis, as that's often what fixes these cases on development or otherwise new installs.

Windshaft-CartoDB already does this, so would be consistent for "cartodb APIs" to also do here.

strk avatar Apr 15 '14 14:04 strk

Actually, I see the hinting is done by cartodb-redis module, not sure why it doesn't appear in the CartoDB-SQL-API

strk avatar Apr 15 '14 14:04 strk

See https://github.com/CartoDB/node-cartodb-redis/blob/v0.3.0/lib/carto_metadata.js#L81

strk avatar Apr 15 '14 14:04 strk

It's because in the usage from CartoDB-SQL-API it's not handling any error https://github.com/CartoDB/CartoDB-SQL-API/blob/master/app/controllers/app.js#L287-L296

rochoa avatar Apr 15 '14 14:04 rochoa

It actually is handling the error, but it looks like it's intentionally modifying it: https://github.com/CartoDB/CartoDB-SQL-API/blob/master/app/controllers/app.js#L300-L303

The modification was probably meant for the enduser, but in the log we'd still want the full error

strk avatar Apr 15 '14 14:04 strk

I'd just review if the cartodb-redis module error is "safe" to show to the user (I think it likely is) and confirmed that just drop the err.message override (keeping the http_response addition)

strk avatar Apr 15 '14 14:04 strk

Maybe one way to deal with log vs. enduser message separation would be to add an optional "user_message" to the Error object thrown. The responder would then show that one to the user, if present (still logging the "message" member).

strk avatar May 07 '14 09:05 strk

The failure we'd currently get by simply skipping the override:

  1) app.test GET decent error if domain is incorrect:

      + expected - actual

      +Sorry, we can't find CartoDB user 'vizzualinot'. Please check that you have entered the correct domain.                                                                                      
      -missing vizzualinot's database_name in redis (try CARTODB/script/restore_redis)

strk avatar May 07 '14 09:05 strk

Another idea (probably simpler) would be to only override the error message IFF environment != "development"

strk avatar May 07 '14 09:05 strk