Skip to content

Commit bfefee5

Browse files
benthomassonclaudeAlanCoding
authored
fix: NameError in wsrelay when JSON decode fails with DEBUG logging (#16340)
* fix: NameError in wsrelay when JSON decode fails with DEBUG logging run_connection() referenced payload in the JSONDecodeError handler, but payload was never assigned because json.loads() is what failed. Use msg.data instead to log the raw message content. Fixes: AAP-68045 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix other instance of undefined payload --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: AlanCoding <arominge@redhat.com>
1 parent 0aaca1b commit bfefee5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

awx/main/wsrelay.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ async def run_connection(self, websocket: aiohttp.ClientWebSocketResponse):
139139
except json.JSONDecodeError:
140140
logmsg = "Failed to decode message from web node"
141141
if logger.isEnabledFor(logging.DEBUG):
142-
logmsg = "{} {}".format(logmsg, payload)
142+
logmsg = "{} {}".format(logmsg, msg.data)
143143
logger.warning(logmsg)
144144
continue
145145

@@ -242,7 +242,7 @@ async def on_ws_heartbeat(self, conn):
242242
except json.JSONDecodeError:
243243
logmsg = "Failed to decode message from pg_notify channel `web_ws_heartbeat`"
244244
if logger.isEnabledFor(logging.DEBUG):
245-
logmsg = "{} {}".format(logmsg, payload)
245+
logmsg = "{} {}".format(logmsg, notif.payload)
246246
logger.warning(logmsg)
247247
continue
248248

0 commit comments

Comments
 (0)