Cakeday plante lors de l'appel API sur des utilisateurs non authentifiés

Salut,

Je rencontre actuellement cette erreur si j’active cakeday et que l’utilisateur n’est pas connecté :


    Message

    NoMethodError (undefined method user_option' for nil:NilClass) (eval):86:in _fast_attributes’
    app/serializers/post_stream_serializer_mixin.rb:54:in block in posts' app/serializers/post_stream_serializer_mixin.rb:47:in map’
    app/serializers/post_stream_serializer_mixin.rb:47:in posts' app/serializers/post_stream_serializer_mixin.rb:18:in post_stream’
    (eval):3:in _fast_attributes' app/controllers/application_controller.rb:545:in render_json_dump’
    app/controllers/topics_controller.rb:1249:in block (2 levels) in perform_show_response' app/controllers/topics_controller.rb:1239:in perform_show_response’
    app/controllers/topics_controller.rb:187:in show' app/controllers/application_controller.rb:414:in block in with_resolved_locale’
    app/controllers/application_controller.rb:414:in with_resolved_locale' lib/middleware/omniauth_bypass_middleware.rb:74:in call’
    lib/middleware/content_security_policy/middleware.rb:12:in call' lib/middleware/anonymous_cache.rb:367: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:228:in call’

    Backtrace

    plugins/discourse-cakeday/plugin.rb:68:in block (2 levels) in activate!' (eval):86:in _fast_attributes’
    /nix/store/jlw6xd3hvk4jdrp1aiiap9h62y13c7dj-ruby3.2.2-active_model_serializers-0.8.4/lib/ruby/gems/3.2.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:468:in rescue in attributes' /nix/store/jlw6xd3hvk4jdrp1aiiap9h62y13c7dj-ruby3.2.2-active_model_serializers-0.8.4/lib/ruby/gems/3.2.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:455:in attributes’
    /nix/store/jlw6xd3hvk4jdrp1aiiap9h62y13c7dj-ruby3.2.2-active_model_serializers-0.8.4/lib/ruby/gems/3.2.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:480:in _serializable_hash' /nix/store/jlw6xd3hvk4jdrp1aiiap9h62y13c7dj-ruby3.2.2-active_model_serializers-0.8.4/lib/ruby/gems/3.2.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:359:in serializable_hash’
    /nix/store/jlw6xd3hvk4jdrp1aiiap9h62y13c7dj-ruby3.2.2-active_model_serializers-0.8.4/lib/ruby/gems/3.2.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:347:in as_json' app/serializers/post_stream_serializer_mixin.rb:54:in block in posts’
    /nix/store/k92bjvqvynnbrvdd26vfg7cf5vh3dxhj-ruby3.2.2-activerecord-7.0.4.3/lib/ruby/gems/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/relation/delegation.rb:88:in each' /nix/store/k92bjvqvynnbrvdd26vfg7cf5vh3dxhj-ruby3.2.2-activerecord-7.0.4.3/lib/ruby/gems/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/relation/delegation.rb:88:in each’

    Env

    HTTP HOSTS: forum.miki.community

Cela semble causer une réponse 500 et une page d’erreur “Oops” :confused:

Salut MTRNord :slight_smile:

Je n’arrive pas à reproduire votre problème. Pouvez-vous décrire les étapes de reproduction précises ?

En fait, je l’ai résolu maintenant et je n’ai pas encore eu le temps de mettre à jour ceci, désolé ! Le problème était une incompatibilité de version. :slight_smile: La mise à jour vers la version 3.2.0.beta1 l’a fait fonctionner correctement.

2 « J'aime »

Ce sujet a été automatiquement fermé après 16 heures. Les nouvelles réponses ne sont plus autorisées.