File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1412,7 +1412,13 @@ async def listen(sub_id: int, user: User = Depends(get_current_user)):
14121412 """Listen messages from a subscribed Pub/Sub channel"""
14131413 metrics .add ('http_requests_total' , 1 )
14141414 try :
1415- return await pubsub .listen (sub_id , user .username )
1415+ result = await pubsub .listen (sub_id , user .username )
1416+ # Debug: print result type and check for bytes
1417+ print (f"[DEBUG listen] result type: { type (result )} " )
1418+ if result :
1419+ for k , v in result .items ():
1420+ print (f"[DEBUG listen] { k } : { type (v )} = { repr (v )[:100 ]} " )
1421+ return result
14161422 except KeyError as error :
14171423 raise HTTPException (
14181424 status_code = status .HTTP_404_NOT_FOUND ,
@@ -1423,6 +1429,10 @@ async def listen(sub_id: int, user: User = Depends(get_current_user)):
14231429 status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
14241430 detail = f"Error while listening to sub id { sub_id } : { str (error )} "
14251431 ) from error
1432+ except Exception as error :
1433+ print (f"[DEBUG listen] Unexpected error: { type (error ).__name__ } : { error } " )
1434+ traceback .print_exc ()
1435+ raise
14261436
14271437
14281438@app .post ('/publish/{channel}' )
You can’t perform that action at this time.
0 commit comments