Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all api endpoints resolve #12

Open
frabarz opened this issue Aug 19, 2020 · 2 comments
Open

Ensure all api endpoints resolve #12

frabarz opened this issue Aug 19, 2020 · 2 comments
Labels

Comments

@frabarz
Copy link

frabarz commented Aug 19, 2020

API endpoints need a revision to ensure all errors are caught. Some of the endpoints only send a response to the client when the queries to the database are completed successfully, but if a parameter is badly constructed, the query fails and the server doesn't response, leading to a timeout.

Also in some cases, there's a condition where the server should send an error and stop the execution, but just sending a response with express doesn't stop the flow of the function, it must return.

@davelandry
Copy link
Member

davelandry commented Aug 20, 2020

If true, this is something we should take care of sooner rather than later. Thanks for finding this @frabarz. Do you have a couple example queries where these errors occur?

Also, TIL this is an express library. I always assumed it was like, a little python app that @jspeis put together!

@davelandry davelandry added the bug label Aug 20, 2020
@frabarz
Copy link
Author

frabarz commented Aug 20, 2020

Looking again, the code is different depending on the project. The error we found was on the /neighbors/:geoId endpoint for the datamexico-refactor branch.

For the national level on datamexico, tesseract was requesting the neighbors for code mex instead of an integer. That, along with datamexico's level config which defined nation in shapes but not in idMapping, defined an invalid query which was not intercepted by the if, and it throwed when sent to the db without a catch. The error appears in the log but httpResult was never called and the requesting server is left waiting until it itself timeouts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants