graphql-python / graphql-python/graphql-core-legacy
Exceptions in subscriptions is not logging
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 371
- Forks
- 175
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
I've just found that exceptions in subscriptions are not logging, but the message of an exceptions returns to client.
class OrderBookSubscription(graphene.ObjectType):
order_book = graphene.Field(
OrderBook,
pair_id=graphene.Int(required=True)
)
@classmethod
async def resolve_order_book(cls, root, info, pair_id):
listener = info.context['not exists key']
Request:
{"id":"3","type":"start","payload":{"variables":{"pairId":11},"extensions":{},"operationName":"OrderBookWS","query":"subscription OrderBookWS($pairId: Int!) {\n orderBook(pairId: $pairId) {\n buy {\n price\n volume\n share\n __typename\n }\n sell {\n price\n volume\n share\n __typename\n }\n spread\n __typename\n }\n}\n"}}
Response:
{"id": "3", "type": "data", "payload": {"data": {"orderBook": null}, "errors": [{"message": "'not exists key'"}]}}
{"id": "3", "type": "complete"}
Logs:
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
2020-07-08 12:06:15,070 - Rx - DEBUG - CurrentThreadScheduler.schedule(state=None)
2020-07-08 12:06:15,072 - Rx - DEBUG - CurrentThreadScheduler.schedule(state=None)
2020-07-08 12:06:15,072 - Rx - DEBUG - CurrentThreadScheduler.schedule(state=None)
Also i've found exception handler, in which need to log the exception.
https://github.com/graphql-python/graphql-core-legacy/blob/master/graphql/execution/executors/asyncio_utils.py#L28
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with graphql/execution/executors/asyncio_utils.py at the exception handler linked in the issue, then reproduce the OrderBookSubscription example with the missing context key. Confirm that the exception is logged while the subscription response still reports the error to the client.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100