serratus-bio / open-virome

monorepo for data explorer UI and APIs
http://openvirome.com/
GNU Affero General Public License v3.0
0 stars 0 forks source link

AWS lambda function errors coming from the DB are not evident #92

Closed almosnow closed 2 weeks ago

almosnow commented 2 weeks ago

Errors that come from a database query or procedure (not from the lambda per se) are not being surfaced out

This makes things much harder to debug

Fix is adding try/catch causes and explicitly checking for errors after each db call (which fortunately is only two files now)

lukepereira commented 2 weeks ago

Using the RTK api client for all api requests and error messages is probably the best way to go. I'm already using it with all non-proxy endpoints https://github.com/serratus-bio/open-virome/blob/main/frontend/src/api/client.ts

almosnow commented 2 weeks ago

Hmm, bit of an unrelated issue.

This is about getting an error message (on the client) when a query fails because of something that's related to postgres (most common one would be a query syntax error).

lukepereira commented 2 weeks ago

the RTK client does error handling on the UI (also helps with caching and retries)*

almosnow commented 2 weeks ago

Try,

curl 'https://zrdbegawce.execute-api.us-east-1.amazonaws.com/prod/counts'   -H 'content-type: application/json'   --data-raw '{"idColumn":"bioproject","ids":["YEAH IM NOT SO SURE OF THAT"],"idRanges":[],"groupBy":"organism"}'

Gives back W10=, no error message.

almosnow commented 2 weeks ago

In this case it's pretty clear why that query is wrong, but in some cases not so much.

I'll just do a giant try/catch and forward all errors to the frontend.

ababaian commented 2 weeks ago

What's the advantage of the RTK api client? I'm unaware of the difference between the methods here.

ababaian commented 2 weeks ago

Please add a Time Estimate: for this issue.

almosnow commented 2 weeks ago

Time spent was ~hour.