graphql-python / graphql-python/graphql-core-legacy

Exceptions in subscriptions is not logging

オープン
#280 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
372
フォーク
175
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello!

I've just found that exceptions in subscriptions are not logging, but the message of an exceptions returns to client.

```python
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:
```json
{"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:
```json
{"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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api, backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。