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

Handle invalid JSON from KPs #369

Open
cbizon opened this issue May 19, 2022 · 4 comments
Open

Handle invalid JSON from KPs #369

cbizon opened this issue May 19, 2022 · 4 comments

Comments

@cbizon
Copy link
Contributor

cbizon commented May 19, 2022

Query:

{
  "message": {
    "query_graph": {
      "edges": {
        "e03": {
          "subject": "n02",
          "object": "liver",       
          "predicates":["biolink:related_to"]
        }
      },
      "nodes": {
        "n02": {
          "categories": ["biolink:DiseaseOrPhenotypicFeature"]
        },
        "liver":
          {
              "ids": ["UBERON:0002107"]
          }
      }
    }
  }
}

Result:

'message': {},
 'logs': [{'message': "Exception in Strider: ValueError('Out of range float values are not JSON compliant')",
   'level': 'ERROR',
   'timestamp': '2022-05-19T14:03:05.986667',
   'stack': 'Traceback (most recent call last):\n  File "/app/./strider/server.py", line 103, in catch_exceptions_middleware\n    return await call_next(request)\n  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 45, in call_next\n    task.result()\n  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 38, in coro\n    await self.app(scope, receive, send)\n  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/cors.py", line 78, in __call__\n    await self.app(scope, receive, send)\n  File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__\n    raise exc from None\n  File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__\n    await self.app(scope, receive, sender)\n  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 580, in __call__\n    await route.handle(scope, receive, send)\n  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 241, in handle\n    await self.app(scope, receive, send)\n  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 52, in app\n    response = await func(request)\n  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 214, in app\n    raw_response = await run_endpoint_function(\n  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 149, in run_endpoint_function\n    return await dependant.call(**values)\n  File "/app/./strider/server.py", line 343, in sync_query\n    return JSONResponse(query_results)\n  File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 53, in __init__\n    self.body = self.render(content)\n  File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 161, in render\n    return json.dumps(\n  File "/usr/local/lib/python3.9/json/__init__.py", line 234, in dumps\n    return cls(\n  File "/usr/local/lib/python3.9/json/encoder.py", line 199, in encode\n    chunks = self.iterencode(o, _one_shot=True)\n  File "/usr/local/lib/python3.9/json/encoder.py", line 257, in iterencode\n    return _iterencode(o, 0)\nValueError: Out of range float values are not JSON compliant\n'}]}
@maximusunc
Copy link
Collaborator

This is actually happening when we're trying to return the completed response. I'm still looking into it to see what response we're trying to send back.

@cbizon
Copy link
Contributor Author

cbizon commented May 19, 2022

So is strider getting a 500 or something from aragorn when strider tries to post the result?

@maximusunc
Copy link
Collaborator

Strider is 500ing when it tries to return the result. I got a look at the response, and I'm seeing some Infinitys from Spoke, which is breaking things in starlette.

@maximusunc maximusunc changed the title 500 on onehop Handle invalid JSON from KPs May 19, 2022
@cbizon
Copy link
Contributor Author

cbizon commented May 19, 2022

Yikes - probably worth bugging spoke about

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

No branches or pull requests

2 participants