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

API returns invalid json if SQL query fails #6194

Open
jc-harrison opened this issue Jul 3, 2023 · 1 comment
Open

API returns invalid json if SQL query fails #6194

jc-harrison opened this issue Jul 3, 2023 · 1 comment
Labels
bug Something isn't working FlowAPI Issues related to the FlowKit API

Comments

@jc-harrison
Copy link
Member

jc-harrison commented Jul 3, 2023

Describe the bug

If a FlowAPI get_query_result request successfully gets result-retrieval SQL from flowmachine, but an error occurs while executing the SQL query, the API will send a 200 response with incomplete content ('{"query_id":"<query_id>", "query_result":['), because the result-streaming begins before the query is actually executed. This results in the following misleading error in flowclient:

JSONDecodeError: Expecting value: line 1 column 65 (char 64)

Product

FlowAPI

Version

1.18.1

Expected behaviour

If the result-retrieval SQL fails to execute, the response code should indicate an error (probably 500).

@jc-harrison jc-harrison added bug Something isn't working FlowAPI Issues related to the FlowKit API labels Jul 3, 2023
@greenape
Copy link
Member

Part of the issue is that we catch a bare exception, log it, and then carry on, where we should almost certainly re-raise or throw a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FlowAPI Issues related to the FlowKit API
Projects
None yet
Development

No branches or pull requests

2 participants