NoMethodError (undefined method `id' for #<Guardian…

I’ve gotten these some days time now. Everything seems working, but surely I don’t know what is happening under the hood. Should I be worried or do something? Is is coming fron an attempt to delete anon-post?

Discourse is updated about 10 hours ago…

Message (16 copies reported)

NoMethodError (undefined method `id' for #<Guardian::AnonymousUser:0x00007f5fe7ae9ea0>)
lib/guardian.rb:624:in `is_my_own?'
lib/guardian/post_guardian.rb:262:in `can_delete_post_action?'
app/controllers/application_controller.rb:422:in `block in with_resolved_locale'
app/controllers/application_controller.rb:422:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:64:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:387:in `call'
lib/middleware/gtm_script_nonce_injector.rb:10:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:233:in `call'

Backtrace

lib/guardian.rb:624:in `is_my_own?'
lib/guardian/post_guardian.rb:262:in `can_delete_post_action?'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:230:in `format_like_user'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:236:in `block in format_likes_users'
activerecord (7.0.7) lib/active_record/relation/delegation.rb:88:in `each'
activerecord (7.0.7) lib/active_record/relation/delegation.rb:88:in `each'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:236:in `map'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:236:in `format_likes_users'
plugins/discourse-reactions/app/controllers/discourse_reactions/custom_reactions_controller.rb:160:in `post_reactions_users'
actionpack (7.0.7) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'

Env

HTTP HOSTS: foorumi.katiska.eu
1 Like

I could be wrong, but it looks like an Anonymous Mode user is having trouble deleting a post?

I’m quite sure there is no such case. I would bet it must be something automatic process happening on background, and I can’t undestand that either.

On my forum anon-posting happends almost never and even then it was by regular users. There is small chance I’ve deleted some old and non-relevant topics, but I can’t remember there would be anons either. And yes, my forum is so low traffic that I can rely my memory over SQL :rofl:

I had one user who didn`t confirm email for some reasons and system killed his account some days ago. All he did was giving likes, nothing else. And now I have a feeling (sorry I can’t give more solid info) that error started popping up at same time.

1 Like

It is connected to Discourse Reactions somehow, so the giving of Likes could be relevant.

How did they manage to interact without first verifying their email/activating their account?

Good question.

I had installed Disable Email Verification for Discourse Plugin but it was disabled at that moment. Could it leak somehow? But still… I don’t follow common rules because I don’t have spam issues (one benefit when is part of language minority…) so I give TL1 right away after registration so that could break things too?

So… is there something somewhere I can start digging? And the most important question: will world come to its end if I don’t do anythind?

1 Like

It may or may not has something to do at least with that automatic TL1, but with disable email verification too. I have these several times with same user all the time:

id: 606
username: saja
name: Saja
created_at: 2023-10-28 14:34:13 UTC
trust_level: 1
last_seen_at: 
last_emailed_at:

2.11., 28.10., 12.10., and 27.9. Strange is that admin log doesn’t show any IP addresses for that user. Every other deletion for non activate accounts show IP.

It’s looking like it’s connected to the allow_anonymous_likes setting somehow.

I’ve had a bit of a play to see if I can trigger the same error, but entering Anonymous Mode and throwing some Likes/Reactions around and then removing them or deleting the posts hasn’t triggered it. I also toggled off allow_anonymous_likes midway through and there was no conflict, it just disallowed being able to remove them. It also respected the post undo action window mins setting too.

I am not sure. :thinking:

1 Like

Hey, sorry that it could be linked to my plugin. Could you try disabling it and see if that fixes it? Haven’t had much time to work on it but if it’s related to my plugin do let me know and I’ll take a look. I want to provide as much support as I can to users of my plugin.

Have it enabled here and have no issues except for the ones explicitly mentioned on the thread. (Although I don’t have the auto TL1 you have)