atom/teletype-server

Attempt to fetch portal with invalid UUID sends error to Bugsnag

jasonrudolph opened this issue · 1 comments

Seen in bugsnag:

https://app.bugsnag.com/atom-tachyon/atom-tachyon/errors/5a0414e38d595a001a0599e8?&event_id=5a04a8a7c5f5710018ce111f

error /app/node_modules/pg/lib/connection.js:539

invalid input syntax for uuid: "b9106b2ecdcf336c5df16096890e29a4ef8f1bcc"

Linked event: 1 hour ago · Nov 9th, 19:12:39 UTC

error invalid input syntax for uuid: "acb1f8fe4a92e09869061fd5c633fcdce2b6019b" 
    /app/node_modules/pg/lib/connection.js:539:11 parseE
    /app/node_modules/pg/lib/connection.js:366:17 parseMessage
    /app/node_modules/pg/lib/connection.js:105:22 none
    events.js:96:13 emitOne
    events.js:191:7 emit
    _stream_readable.js:178:18 readableAddChunk
    _stream_readable.js:136:10 push
    net.js:561:20 onread

Expected behavior: The app should gracefully handle invalid portal ID values. If a user attempts to fetch the info for a portal using an invalid portal ID, the app should respond with a 404 and no error should get logged to Bugsnag.

I think the application is correctly responding with a 404, but we are failing to store the event into the events table. I think it might be interesting to store invalid UUIDs, as it could give us a sense of how many times people accidentally use the OAuth token (or any other kind of invalid string) instead of an existing portal ID.

I'll go ahead and turn the column type into a string, so that storing events work correctly when the portal id is malformed.