Posts with embedded polls fail to load

Since the upgrade to v2.4.0beta8 posts having embedded pools fail to load with the following traceback:

/discourse/vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.1/lib/active_model/attribute_methods.rb:431:in `method_missing'
/discourse/vendor/bundle/ruby/2.6.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:99:in `block in attribute'
(eval):15:in `_fast_attributes'
/discourse/vendor/bundle/ruby/2.6.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:468:in `rescue in attributes'
/discourse/vendor/bundle/ruby/2.6.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:455:in `attributes'
/discourse/vendor/bundle/ruby/2.6.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:480:in `_serializable_hash'
/discourse/vendor/bundle/ruby/2.6.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:359:in `serializable_hash'
/discourse/vendor/bundle/ruby/2.6.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:347:in `as_json'
/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/json/encoding.rb:22:in `encode'
/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/json/encoding.rb:22:in `encode'
/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/json.rb:42:in `to_json'
/discourse/vendor/bundle/ruby/2.6.0/gems/active_model_serializers-0.8.4/lib/active_model/serializer.rb:331:in `to_json'
/discourse/vendor/bundle/ruby/2.6.0/gems/multi_json-1.13.1/lib/multi_json/adapters/oj.rb:40:in `dump'
/discourse/vendor/bundle/ruby/2.6.0/gems/multi_json-1.13.1/lib/multi_json/adapters/oj.rb:40:in `dump'
/discourse/vendor/bundle/ruby/2.6.0/gems/multi_json-1.13.1/lib/multi_json/adapter.rb:25:in `dump'
/discourse/vendor/bundle/ruby/2.6.0/gems/multi_json-1.13.1/lib/multi_json.rb:139:in `dump'
/discourse/app/controllers/topics_controller.rb:1003:in `block (2 levels) in perform_show_response'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
/discourse/app/controllers/topics_controller.rb:1000:in `perform_show_response'
/discourse/app/controllers/topics_controller.rb:164:in `show'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/abstract_controller/base.rb:196:in `process_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:135:in `run_callbacks'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications.rb:180:in `block in instrument'
/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications.rb:180:in `instrument'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/abstract_controller/base.rb:136:in `process'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.1/lib/action_view/rendering.rb:39:in `process'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-1.1.3/lib/mini_profiler/profiling_methods.rb:104:in `block in profile_method'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal.rb:191:in `dispatch'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal.rb:252:in `dispatch'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/routing/route_set.rb:51:in `dispatch'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/routing/route_set.rb:33:in `serve'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/journey/router.rb:49:in `block in serve'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/journey/router.rb:32:in `each'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/journey/router.rb:32:in `serve'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/routing/route_set.rb:837:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.0.7/lib/rack/protection/frame_options.rb:31:in `call'
/discourse/lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/tempfile_reaper.rb:15:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/conditional_get.rb:25:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/head.rb:12:in `call'
/discourse/lib/content_security_policy/middleware.rb:12:in `call'
/discourse/lib/middleware/anonymous_cache.rb:274:in `call'
/discourse/config/initializers/008-rack-cors.rb:25:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/session/abstract/id.rb:232:in `context'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/session/abstract/id.rb:226:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/cookies.rb:648:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:101:in `run_callbacks'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/logster-2.4.1/lib/logster/middleware/reporter.rb:43:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.1/lib/rails/rack/logger.rb:38:in `call_app'
/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.1/lib/rails/rack/logger.rb:28:in `call'
/discourse/config/initializers/100-quiet_logger.rb:18:in `call'
/discourse/config/initializers/100-silence_logger.rb:31:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/discourse/lib/middleware/enforce_hostname.rb:17:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/method_override.rb:22:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/static.rb:126:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/sendfile.rb:111:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_dispatch/middleware/host_authorization.rb:77:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-1.1.3/lib/mini_profiler/profiler.rb:296:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.3/lib/message_bus/rack/middleware.rb:57:in `call'
/discourse/lib/middleware/request_tracker.rb:176:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.1/lib/rails/engine.rb:526:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `public_send'
/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `method_missing'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/urlmap.rb:68:in `block in call'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/urlmap.rb:53:in `each'
/discourse/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/urlmap.rb:53:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/configuration.rb:227:in `call'
/discourse/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:660:in `handle_request'
/discourse/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:474:in `process_client'
/discourse/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:334:in `block in run'
/discourse/vendor/bundle/ruby/2.6.0/gems/puma-3.12.1/lib/puma/thread_pool.rb:135:in `block in spawn_thread'

Trying to create a post with a poll fails as well. We don’t install any plugin that is not officially maintained, the same applies to gems as per [1].

Is there anything obvious that we’re missing?

[1] Dockerfile · master · Infrastructure / discourse-web · GitLab

Seems the following migration never ran:

20191114160613_add_graph_to_polls.rb

and as such the polls table looks as follows:

                                        Table "public.polls"
      Column      |            Type             |                     Modifiers                      
------------------+-----------------------------+----------------------------------------------------
 id               | bigint                      | not null default nextval('polls_id_seq'::regclass)
 post_id          | bigint                      | 
 name             | character varying           | not null default 'poll'::character varying
 close_at         | timestamp without time zone | 
 type             | integer                     | not null default 0
 status           | integer                     | not null default 0
 results          | integer                     | not null default 0
 visibility       | integer                     | not null default 0
 min              | integer                     | 
 max              | integer                     | 
 step             | integer                     | 
 anonymous_voters | integer                     | 
 created_at       | timestamp without time zone | not null
 updated_at       | timestamp without time zone | not null
Indexes:
    "polls_pkey" PRIMARY KEY, btree (id)
    "index_polls_on_post_id_and_name" UNIQUE, btree (post_id, name)
    "index_polls_on_post_id" btree (post_id)
Foreign-key constraints:
    "fk_rails_b50b782d08" FOREIGN KEY (post_id) REFERENCES posts(id)
Referenced by:
    TABLE "poll_votes" CONSTRAINT "fk_rails_a6e6974b7e" FOREIGN KEY (poll_id) REFERENCES polls(id)
    TABLE "poll_options" CONSTRAINT "fk_rails_aa85becb42" FOREIGN KEY (poll_id) REFERENCES polls(id)

Migrations are ran at every container launch via init containers, next question is understanding why this specific one was never scheduled.

Migration ran and it fixed the problem taking in another one though:

SecurityError: The operation is insecure. Url: https://discourse.gnome.org/assets/application-6cbf6fb051e218dafa1bf601dae045b532b3ec5125762bb09aac8ffaf3f25958.js Line: 1 Column: 0 

SecurityError: The operation is insecure.
Url: https://discourse.gnome.org/assets/application-6cbf6fb051e218dafa1bf601dae045b532b3ec5125762bb09aac8ffaf3f25958.js
Line: 1
Column: 0
Window Location: https://discourse.gnome.org//t/is-it-time-to-turn-shell-extension-version-locking-back-on/809

replaceState@https://discourse.gnome.org/assets/application-6cbf6fb051e218dafa1bf601dae045b532b3ec5125762bb09aac8ffaf3f25958.js:1:392500
initState@https://discourse.gnome.org/assets/application-6cbf6fb051e218dafa1bf601dae045b532b3ec5125762bb09aac8ffaf3f25958.js:1:391813
init@https://discourse.gnome.org/assets/application-6cbf6fb051e218dafa1bf601dae045b532b3ec5125762bb09aac8ffaf3f25958.js:1:391567
e@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:290766
h@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:281717
f</e.create@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:283033
v</t.create@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:94398
h/<@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:92267
h@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:92643
n</t.lookup@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:91157
lookup@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:272294
_</n._setupLocation@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:243579
_</n.setupRouter@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:240697
_</n.startRouting@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:240535
startRouting@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:319395
didBecomeReady@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:324708
f</t.invoke@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:482548
f</t.flush@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:481548
p</t.flush@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:483563
t</t._end@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:488992
t</t.end@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:485528
t</t._run@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:489530
t</t._join@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:489315
t</t.join@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:486236
p@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:352709
e.bind/<@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:352933
e@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:29470
l/</t<@https://discourse.gnome.org/assets/ember_jquery-c2cca4a19fd4c70eabc95b010a6d7643955ec2a2251aeb1d70f625773eebea21.js:1:29794

Are you aware that this is a custom install that ditches all the work we do in our custom docker image to ensure that errors like missing migrations never happen?

I think that your custom thing is missing the plugins migrations on boot. Migrations in plugins are rare and that’s the reason it didn’t blow up earlier.

5 Likes

Thanks for your feedback, pretty much anything on our Infrastructure is customized to work on top of tools like Openshift and I see what we may have missed there. We’ll have to look into possibly using upstream’s docker image in the future and most importantly sticking with a stable release (we’re using tests-passed right now). Do you have any feeling regarding the other issue I mentioned? I’d appreciate your feedback there as well. Thanks!

That is a javascript error, which can be caused by users with bad configured browsers, extensions, etc.

In this specific case the URL is completely malformed

https://discourse.gnome.org//t/is-it-time-to-turn-shell-extension-version-locking-back-on/809

Pay attention to the double //, that is either user typo or a badly configured reverse proxy.

2 Likes

Ah indeed, just saw the bad rewrite, fixed that and we’re back! Thanks a lot for your help Rafael, I appreciate it esp. due to the fact our installation is heavily customized. Have a great day!

1 Like

This is very important, as the two issues you had today were all self-inflicted. Both are impossible when running a supported install.

Love the Gnome project, keep up the good work!

2 Likes

For those who are interested, the second error also happens here on meta - visit https://meta.discourse.org//t/posts-with-embedded-polls-fail-to-load/135549 as an example :slight_smile:

It looks like the basic URL parser spec says that a browser will always throw a validation error if a path starts with two slashes.

I suppose that one could argue that discourse should be checking that the path it is passing to history.replaceState() is valid before it does so and fixing it, but that sounds like a whole heap of pain (ie: implementing your own url parser and automagical fixer) for something which would be fairly rare in the wild.

This post has been brought to you by melted brains from reading WHATWG HTML living standards

2 Likes

Since this topic was auto-bumped today, I figured I’d give this a try. Testing this URL with the latest Chrome browser on Ubuntu:
https://meta.discourse.org//t/posts-with-embedded-polls-fail-to-load/135549/9

The URL is now being rewritten to fix the double // and loading for me without any issues: https://meta.discourse.org//t/posts-with-embedded-polls-fail-to-load/135549/9

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.