How to look up a user based on a user_id?

AI-generated summary

The discussion addresses how to look up a user by user_id in Discourse. SkritterJosh reports a high number of failed email jobs linked to user_id 398 and cannot locate the user via the interface. Blake suggests using the Rails console with User.find(398) and provides a guide for accessing it in production. Fefrei recommends using the Data Explorer plugin with a SQL query to retrieve the user. DeanMarkTaylor offers a quick method by accessing the user’s JSON data directly via http://discourse.example.com/admin/users/398.json while logged in as an admin.

I’ve been looking at sidekiq and noticing an abnormally high number of failed Jobs::UserEmail jobs. Looking into the arguments almost all of them seem to be coming from the same user id. It’s import to note that all other emails are sending normally.

{"type"=>"digest", "user_id"=>398, "current_site_id"=>"default"}

Jobs::HandledExceptionWrapper: Wrapped Net::SMTPServerBusy: 401 4.1.3 Bad recipient address syntax

I’m unable to actually find the user by id to figure out where all these failed attempts are coming from. Any thoughts?

I’m not sure if you can through the Discourse interface, but you could use the Rails console:

u = User.find(398)

Alternatively, you can use the awesome Data Explorer plugin:

SELECT *
FROM users
WHERE id = 398

For me the quickest way is simply to make a request like this whilst logged in as admin:
http://discourse.example.com/admin/users/398.json

This will get the user by ID 398.

Yes, the result is JSON but it’s pretty easy to read the first few lines.