You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This took me the better part of an afternoon to identify, mostly because I thought it was something else. (I thought it was related to actions I was taking as a user).
ValueError: Failed to get the user 1231072357033185361
This occurs when curl webhook posts into a discord channel Errbot is monitoring.
In this case, fail2ban, as shown here:
actionstop = curl -X POST "<discord_webhook_url>"
-H "Content-Type: application/json"
-d '{"username": "Fail2Ban", "content":":no_entry: The [] jail has been stopped"}'
(with or without "username":"Fail2Ban", doesn't seem to matter)
It tries to use on_message() against it (from err-backend-discord.py) -- the first thing it does is
self.discord_user = DiscordPerson.client.get_user(self._user_id)
if self.discord_user is None:
raise ValueError(f"Failed to get the user {self._user_id}")
Unsurprisingly, because it's not a real user, so you can't reference a username. discord_user will always return 'None' in this case.
My workaround was to switch the raise in room.py (~line 79) to:
log.info("Ignoring message from id %s, username is %s, which means it is likely a webhook.", self._user_id, username)
and to add this around line 100 of err-backend-discord.py
if msg.author.bot:
return
I.e. this is not a person, so do not continue to process them.
I'm not convinced this is anything like an ideal result, but in the short term it silences this error. I'm open to alternatives, and I'd happily try my hand at writing a patch that is better than this hack.
Hopefully this issue helps someone else who sees this in their logs.
The text was updated successfully, but these errors were encountered:
This took me the better part of an afternoon to identify, mostly because I thought it was something else. (I thought it was related to actions I was taking as a user).
ValueError: Failed to get the user 1231072357033185361
This occurs when curl webhook posts into a discord channel Errbot is monitoring.
In this case, fail2ban, as shown here:
actionstop = curl -X POST "<discord_webhook_url>"
-H "Content-Type: application/json"
-d '{"username": "Fail2Ban", "content":":no_entry: The [] jail has been stopped"}'
(with or without "username":"Fail2Ban", doesn't seem to matter)
It tries to use on_message() against it (from err-backend-discord.py) -- the first thing it does is
err_msg.frm = DiscordRoomOccupant(msg.author.id, msg.channel.id)
which immediately does
super().init(user_id)
And fails here:
Unsurprisingly, because it's not a real user, so you can't reference a username. discord_user will always return 'None' in this case.
My workaround was to switch the raise in room.py (~line 79) to:
log.info("Ignoring message from id %s, username is %s, which means it is likely a webhook.", self._user_id, username)
and to add this around line 100 of err-backend-discord.py
I.e. this is not a person, so do not continue to process them.
I'm not convinced this is anything like an ideal result, but in the short term it silences this error. I'm open to alternatives, and I'd happily try my hand at writing a patch that is better than this hack.
Hopefully this issue helps someone else who sees this in their logs.
The text was updated successfully, but these errors were encountered: