Hello !
I have run accross a weird error lately :
I cannot display the collections containing an attachement attribute :
On the backend side, the call to the corresponding forest controller raises the following :
β ActiveStorage::Blob Load (1.2ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", 33], ["LIMIT", 1]]
β [2022-10-17 12:55:27] Forest π³π³π³ Records Index error: uninitialized constant ForestLiana::UserSpace::ActiveStorageAttachmentSerializer
β Did you mean? ForestLiana::UserSpace::ActiveStorageVariantrecordSerializer
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:288:in `const_get'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:288:in `block in constantize'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:284:in `each'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:284:in `inject'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:284:in `constantize'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/core_ext/string/inflections.rb:74:in `constantize'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:251:in `find_serializer_class'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:262:in `find_serializer'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:132:in `block in relationships'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:111:in `each'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:111:in `relationships'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:434:in `block in serialize_primary'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/notifications.rb:205:in `instrument'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:407:in `serialize_primary'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:453:in `block in serialize_primary_multi'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:453:in `map'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:453:in `serialize_primary_multi'
β /usr/local/bundle/gems/forestadmin-jsonapi-serializers-2.0.0.pre.beta.2/lib/jsonapi-serializers/serializer.rb:331:in `serialize'
β /usr/local/bundle/gems/forest_liana-7.4.5/app/controllers/forest_liana/application_controller.rb:44:in `serialize_models'
β /usr/local/bundle/gems/forest_liana-7.4.5/app/controllers/forest_liana/resources_controller.rb:244:in `render_jsonapi'
β /usr/local/bundle/gems/forest_liana-7.4.5/app/controllers/forest_liana/resources_controller.rb:36:in `block (2 levels) in index'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
β /usr/local/bundle/gems/forest_liana-7.4.5/app/controllers/forest_liana/resources_controller.rb:35:in `index'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/abstract_controller/base.rb:228:in `process_action'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
β /usr/local/bundle/gems/actiontext-6.1.4.4/lib/action_text/rendering.rb:20:in `with_renderer'
β /usr/local/bundle/gems/actiontext-6.1.4.4/lib/action_text/engine.rb:59:in `block (4 levels) in <class:Engine>'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/callbacks.rb:126:in `instance_exec'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/callbacks.rb:137:in `run_callbacks'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/abstract_controller/callbacks.rb:41:in `process_action'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_controller/metal/rescue.rb:22:in `process_action'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/notifications.rb:203:in `block in instrument'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/notifications.rb:203:in `instrument'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
β /usr/local/bundle/gems/activerecord-6.1.4.4/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/abstract_controller/base.rb:165:in `process'
β /usr/local/bundle/gems/actionview-6.1.4.4/lib/action_view/rendering.rb:39:in `process'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_controller/metal.rb:190:in `dispatch'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_controller/metal.rb:238:in `block in action'
β /usr/local/bundle/gems/forest_liana-7.4.5/app/controllers/forest_liana/router.rb:40:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/mapper.rb:20:in `block in <class:Constraints>'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/mapper.rb:49:in `serve'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/journey/router.rb:32:in `each'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/journey/router.rb:32:in `serve'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/route_set.rb:842:in `call'
β /usr/local/bundle/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
β /usr/local/bundle/gems/railties-6.1.4.4/lib/rails/engine.rb:539:in `call'
β /usr/local/bundle/gems/railties-6.1.4.4/lib/rails/railtie.rb:207:in `public_send'
β /usr/local/bundle/gems/railties-6.1.4.4/lib/rails/railtie.rb:207:in `method_missing'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/mapper.rb:20:in `block in <class:Constraints>'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/mapper.rb:49:in `serve'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/journey/router.rb:32:in `each'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/journey/router.rb:32:in `serve'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/routing/route_set.rb:842:in `call'
β /usr/local/bundle/gems/warden-jwt_auth-0.6.0/lib/warden/jwt_auth/middleware/token_dispatcher.rb:20:in `call'
β /usr/local/bundle/gems/warden-jwt_auth-0.6.0/lib/warden/jwt_auth/middleware/revocation_manager.rb:21:in `call'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/builder.rb:244:in `call'
β /usr/local/bundle/gems/rollbar-3.3.0/lib/rollbar/middleware/rack/builder.rb:16:in `block in call_with_rollbar'
β /usr/local/bundle/gems/rollbar-3.3.0/lib/rollbar.rb:145:in `scoped'
β /usr/local/bundle/gems/rollbar-3.3.0/lib/rollbar/middleware/rack/builder.rb:14:in `call_with_rollbar'
β /usr/local/bundle/gems/warden-jwt_auth-0.6.0/lib/warden/jwt_auth/middleware.rb:22:in `call'
β /usr/local/bundle/gems/warden-1.2.9/lib/warden/manager.rb:36:in `block in call'
β /usr/local/bundle/gems/warden-1.2.9/lib/warden/manager.rb:34:in `catch'
β /usr/local/bundle/gems/warden-1.2.9/lib/warden/manager.rb:34:in `call'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/conditional_get.rb:27:in `call'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/cookies.rb:689:in `call'
β /usr/local/bundle/gems/activerecord-6.1.4.4/lib/active_record/migration.rb:601:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/callbacks.rb:98:in `run_callbacks'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
β /usr/local/bundle/gems/rollbar-3.3.0/lib/rollbar/middleware/rails/rollbar.rb:25:in `block in call'
β /usr/local/bundle/gems/rollbar-3.3.0/lib/rollbar.rb:145:in `scoped'
β /usr/local/bundle/gems/rollbar-3.3.0/lib/rollbar/middleware/rails/rollbar.rb:22:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
β /usr/local/bundle/gems/rollbar-3.3.0/lib/rollbar/middleware/rails/show_exceptions.rb:22:in `call_with_rollbar'
β /usr/local/bundle/gems/web-console-4.2.0/lib/web_console/middleware.rb:132:in `call_app'
β /usr/local/bundle/gems/web-console-4.2.0/lib/web_console/middleware.rb:19:in `block in call'
β /usr/local/bundle/gems/web-console-4.2.0/lib/web_console/middleware.rb:17:in `catch'
β /usr/local/bundle/gems/web-console-4.2.0/lib/web_console/middleware.rb:17:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
β /usr/local/bundle/gems/railties-6.1.4.4/lib/rails/rack/logger.rb:37:in `call_app'
β /usr/local/bundle/gems/railties-6.1.4.4/lib/rails/rack/logger.rb:26:in `block in call'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/tagged_logging.rb:99:in `block in tagged'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/tagged_logging.rb:37:in `tagged'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/tagged_logging.rb:99:in `tagged'
β /usr/local/bundle/gems/railties-6.1.4.4/lib/rails/rack/logger.rb:26:in `call'
β /usr/local/bundle/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
β /usr/local/bundle/gems/request_store-1.5.1/lib/request_store/middleware.rb:19:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/request_id.rb:26:in `call'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
β /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/static.rb:24:in `call'
β /usr/local/bundle/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
β /usr/local/bundle/gems/actionpack-6.1.4.4/lib/action_dispatch/middleware/host_authorization.rb:119:in `call'
β /usr/local/bundle/gems/rack-mini-profiler-2.3.3/lib/mini_profiler/profiler.rb:393:in `call'
β /usr/local/bundle/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
β /usr/local/bundle/gems/webpacker-5.4.3/lib/webpacker/dev_server_proxy.rb:25:in `perform_request'
β /usr/local/bundle/gems/rack-proxy-0.7.2/lib/rack/proxy.rb:67:in `call'
β /usr/local/bundle/gems/railties-6.1.4.4/lib/rails/engine.rb:539:in `call'
β /usr/local/bundle/gems/puma-5.5.2/lib/puma/configuration.rb:249:in `call'
β /usr/local/bundle/gems/puma-5.5.2/lib/puma/request.rb:77:in `block in handle_request'
β /usr/local/bundle/gems/puma-5.5.2/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
β /usr/local/bundle/gems/puma-5.5.2/lib/puma/request.rb:76:in `handle_request'
β /usr/local/bundle/gems/puma-5.5.2/lib/puma/server.rb:447:in `process_client'
β /usr/local/bundle/gems/puma-5.5.2/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
β Completed 500 Internal Server Error in 191ms (ActiveRecord: 20.3ms | Allocations: 55519)
The weirdest part is that it worked before (I already had other collections with attachments) but it occured when I added the attributes on a model. I have rollback my code to the previous change, but it keeps failing on the development environement with the same error (when trying to display the models that already had an attachment.) My remote environement is working well with the same code that I have locally.
Regarding Gem versions, the relevant packages are the following :
- activestorage (= 6.1.4.4)
- rails (6.1.4.4)
- forest_liana (7.4.5)
forestadmin-jsonapi-serializers (>= 0.14.0)
forestadmin-jsonapi-serializers (2.0.0.pre.beta.2)