Closed alecslupu closed 3 years ago
Hey, thanks for the detailed writeup and sorry to hear about the trouble.
That bit of debugging you shared is really helpful. It looks like there are two classes with the same ancestors, but different .object_id
s, right?
Everything in the code you shared looked good to me, so I started looking into the Api.orphan_types
method. One hint I found was this:
See how Api.add_orphan_types
stores @orphan_types
? I wonder if there's a problem with how Rails is reloading that. Do you encounter this error when running tests, or only when running the development server? (If this error happens in the development server, but not the test suite, then it's likely an autoloading issue.)
Another way you could debug is to add some code to Decidim::Core::TranslatedFieldType
:
p [self, self.object_id]
puts caller
That would tell us a few things:
object_id
or different?)caller
will tell us what code is causing the file to be loaded. Could you share the output of that when you replicate the issue?
Hello !
The issue is caused in the development environment. while i am trying to visit the "/api" endpoint to see how is the schema updated.
That bit of debugging you shared is really helpful. It looks like there are two classes with the same ancestors, but different .object_ids, right? I have checked the code before sending the issue request, and there is only one class defined with the name
TranslatedFieldType
and only one definition of a graphql graphql nameTranslatedField
(I have even changed the name to test it )See how Api.add_orphan_types stores @orphan_types? Yes, swicthing to class variable, doesn't changes the behaviour
Do you encounter this error when running tests, or only when running the development server? The issue is caused in the development environment.
I have patched the TranslatedFieldType
class, and now is looking like:
module Decidim
module Core
# This type represents a translated field in multiple languages.
class TranslatedFieldType < Decidim::Api::Types::BaseObject
Rails.logger.info [self, self.object_id]
Rails.logger.info caller.join("\n")
Rails.logger.info "\n"*20
graphql_name "TranslatedField"
# ....
Is the file being loaded by ruby/rails more than once? (Do we get that output twice, or only once? Same object_id or different?) I have also patched the Graphql
Schema.rb
(line 1874) file and addedif (prev_type = own_types[type.graphql_name]) if prev_type != type Rails.logger.info "========================" Rails.logger.info prev_type.object_id Rails.logger.info type.object_id Rails.logger.info "========================" raise DuplicateTypeNamesError.new( type_name: type.graphql_name, first_definition: prev_type, second_definition: type, path: path, ) else
The output is :
backend-app | ======================== backend-app | 108600 backend-app | 136440 backend-app | ========================
Notice that the previous_type object_id is greater than the type id, therefore, i suspect there is a visibility issue within Graphql. I could not find the place where is this happening.
The backtrace is, so the class is defined only once:
backend-app | [Decidim::Core::TranslatedFieldType, 136420]
backend-app | /code/decidim/decidim-core/app/types/decidim/core/translated_field_type.rb:6:in <module:Core>' backend-app | /code/decidim/decidim-core/app/types/decidim/core/translated_field_type.rb:4:in
<main>' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in
load'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in load' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:476:in
block in load_file'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:661:in new_constants_in' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:475:in
load_file'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:373:in block in require_or_load' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:37:in
block in load_interlock'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies/interlock.rb:14:in block in loading' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/concurrency/share_lock.rb:151:in
exclusive'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies/interlock.rb:13:in loading' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:37:in
load_interlock'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:356:in require_or_load' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:49:in
block in require_or_load'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in allow_bootsnap_retry' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in
require_or_load'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:510:in load_missing_constant' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in
block in load_missing_constant'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in allow_bootsnap_retry' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in
load_missing_constant'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:195:in const_missing' backend-app | /code/decidim/decidim-participatory_processes/app/types/decidim/participatory_processes/participatory_process_type.rb:19:in
<module:ParticipatoryProcesses>' backend-app | /code/decidim/decidim-participatory_processes/app/types/decidim/participatory_processes/participatory_process_type.rb:4:in
<main>' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in
load'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in load' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:476:in
block in load_file'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:661:in new_constants_in' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:475:in
load_file'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:373:in block in require_or_load' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:37:in
block in load_interlock'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies/interlock.rb:14:in block in loading' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/concurrency/share_lock.rb:151:in
exclusive'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies/interlock.rb:13:in loading' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:37:in
load_interlock'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:356:in require_or_load' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:49:in
block in require_or_load'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in allow_bootsnap_retry' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in
require_or_load'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:510:in load_missing_constant' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in
block in load_missing_constant'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in allow_bootsnap_retry' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in
load_missing_constant'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:195:in const_missing' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/inflector/methods.rb:285:in
const_get'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/inflector/methods.rb:285:in block in constantize' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/inflector/methods.rb:281:in
each'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/inflector/methods.rb:281:in inject' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/inflector/methods.rb:281:in
constantize'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/core_ext/string/inflections.rb:68:in constantize' backend-app | /code/decidim/decidim-api/lib/decidim/api.rb:14:in
map'
backend-app | /code/decidim/decidim-api/lib/decidim/api.rb:14:in orphan_types' backend-app | /code/decidim/decidim-api/app/types/decidim/api/schema.rb:14:in
<module:Api>' backend-app | /code/decidim/decidim-api/app/types/decidim/api/schema.rb:4:in
<main>' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in
load'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in load' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:476:in
block in load_file'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:661:in new_constants_in' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:475:in
load_file'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:373:in block in require_or_load' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:37:in
block in load_interlock'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies/interlock.rb:14:in block in loading' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/concurrency/share_lock.rb:151:in
exclusive'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies/interlock.rb:13:in loading' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:37:in
load_interlock'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:356:in require_or_load' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:49:in
block in require_or_load'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in allow_bootsnap_retry' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in
require_or_load'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:510:in load_missing_constant' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in
block in load_missing_constant'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in allow_bootsnap_retry' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in
load_missing_constant'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:195:in const_missing' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:542:in
load_missing_constant'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in block in load_missing_constant' backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:17:in
allow_bootsnap_retry'
backend-app | /bundle_cache/ruby/2.7.0/gems/bootsnap-1.4.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in load_missing_constant' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/dependencies.rb:195:in
const_missing'
backend-app | /code/decidim/decidim-api/app/controllers/decidim/api/queries_controller.rb:17:in create' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_controller/metal/basic_implicit_render.rb:6:in
send_action'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/abstract_controller/base.rb:194:in process_action' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_controller/metal/rendering.rb:30:in
process_action'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/abstract_controller/callbacks.rb:42:in block in process_action' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/callbacks.rb:109:in
block in run_callbacks'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/core_ext/time/zones.rb:66:in use_zone' backend-app | /code/decidim/decidim-core/app/controllers/concerns/decidim/use_organization_time_zone.rb:21:in
use_organization_time_zone'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/callbacks.rb:118:in block in run_callbacks' backend-app | /bundle_cache/ruby/2.7.0/gems/sentry-raven-3.1.1/lib/raven/integrations/rails/controller_transaction.rb:7:in
block in included'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/callbacks.rb:118:in instance_exec' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/callbacks.rb:118:in
block in run_callbacks'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/callbacks.rb:136:in run_callbacks' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/abstract_controller/callbacks.rb:41:in
process_action'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_controller/metal/rescue.rb:22:in process_action' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_controller/metal/instrumentation.rb:34:in
block in process_action'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/notifications.rb:168:in block in instrument' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/notifications/instrumenter.rb:23:in
instrument'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/notifications.rb:168:in instrument' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_controller/metal/instrumentation.rb:32:in
process_action'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_controller/metal/params_wrapper.rb:256:in process_action' backend-app | /bundle_cache/ruby/2.7.0/gems/activerecord-5.2.4.4/lib/active_record/railties/controller_runtime.rb:24:in
process_action'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/abstract_controller/base.rb:134:in process' backend-app | /bundle_cache/ruby/2.7.0/gems/actionview-5.2.4.4/lib/action_view/rendering.rb:32:in
process'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_controller/metal.rb:191:in dispatch' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_controller/metal.rb:252:in
dispatch'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/routing/route_set.rb:52:in dispatch' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/routing/route_set.rb:34:in
serve'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/journey/router.rb:52:in block in serve' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/journey/router.rb:35:in
each'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/journey/router.rb:35:in serve' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/routing/route_set.rb:840:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/engine.rb:524:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/railtie.rb:190:in
public_send'
backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/railtie.rb:190:in method_missing' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/routing/mapper.rb:19:in
block in serve' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/journey/router.rb:52:in
block in serve'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/journey/router.rb:35:in each' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/journey/router.rb:35:in
serve'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/routing/route_set.rb:840:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/engine.rb:524:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/railtie.rb:190:in public_send' backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/railtie.rb:190:in
method_missing'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/routing/mapper.rb:19:in block in <class:Constraints>' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/routing/mapper.rb:48:in
serve'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/journey/router.rb:52:in block in serve' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/journey/router.rb:35:in
each'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/journey/router.rb:35:in serve' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/routing/route_set.rb:840:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/batch-loader-1.5.0/lib/batch_loader/middleware.rb:11:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb:192:in
call!'
backend-app | /bundle_cache/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb:169:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/builder.rb:45:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb:192:in call!' backend-app | /bundle_cache/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/strategy.rb:169:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/omniauth-1.9.1/lib/omniauth/builder.rb:45:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/rack/agent_hooks.rb:30:in
traced_call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/rack/browser_monitoring.rb:33:in
traced_call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/warden-1.2.9/lib/warden/manager.rb:36:in
block in call'
backend-app | /bundle_cache/ruby/2.7.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in catch' backend-app | /bundle_cache/ruby/2.7.0/gems/warden-1.2.9/lib/warden/manager.rb:34:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /code/decidim/decidim-core/app/middleware/decidim/strip_x_forwarded_host.rb:11:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /code/decidim/decidim-core/app/middleware/decidim/current_organization.rb:21:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/rack-2.2.3/lib/rack/etag.rb:27:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/rack-2.2.3/lib/rack/conditional_get.rb:40:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/rack-2.2.3/lib/rack/head.rb:12:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/http/content_security_policy.rb:18:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in
context'
backend-app | /bundle_cache/ruby/2.7.0/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/cookies.rb:670:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/activerecord-5.2.4.4/lib/active_record/migration.rb:559:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/callbacks.rb:28:in block in call' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/callbacks.rb:98:in
run_callbacks'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/callbacks.rb:26:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/executor.rb:14:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/debug_exceptions.rb:61:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:135:in call_app' backend-app | /bundle_cache/ruby/2.7.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:30:in
block in call'
backend-app | /bundle_cache/ruby/2.7.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in catch' backend-app | /bundle_cache/ruby/2.7.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/show_exceptions.rb:33:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/rack/logger.rb:38:in
call_app'
backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/rack/logger.rb:26:in block in call' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/tagged_logging.rb:71:in
block in tagged'
backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/tagged_logging.rb:28:in tagged' backend-app | /bundle_cache/ruby/2.7.0/gems/activesupport-5.2.4.4/lib/active_support/tagged_logging.rb:71:in
tagged'
backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/rack/logger.rb:26:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/sprockets-rails-3.2.2/lib/sprockets/rails/quiet_assets.rb:13:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/remote_ip.rb:81:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/request_store-1.5.0/lib/request_store/middleware.rb:19:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/request_id.rb:27:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/rack-2.2.3/lib/rack/method_override.rb:24:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/executor.rb:14:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/actionpack-5.2.4.4/lib/action_dispatch/middleware/static.rb:127:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/sentry-raven-3.1.1/lib/raven/integrations/rack.rb:51:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/secure_headers-6.3.1/lib/secure_headers/middleware.rb:11:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/railties-5.2.4.4/lib/rails/engine.rb:524:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/newrelic_rpm-6.13.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:101:in
call'
backend-app | /bundle_cache/ruby/2.7.0/gems/puma-4.3.6/lib/puma/configuration.rb:228:in call' backend-app | /bundle_cache/ruby/2.7.0/gems/puma-4.3.6/lib/puma/server.rb:713:in
handle_request'
backend-app | /bundle_cache/ruby/2.7.0/gems/puma-4.3.6/lib/puma/server.rb:472:in process_client' backend-app | /bundle_cache/ruby/2.7.0/gems/puma-4.3.6/lib/puma/server.rb:328:in
block in run'
backend-app | /bundle_cache/ruby/2.7.0/gems/puma-4.3.6/lib/puma/thread_pool.rb:134:in `block in spawn_thread'
The load order of my initializers:
- decidim.graphql_api
- decidim_comments.query_extensions
- decidim_comments.mutation_extensions
- decidim_participatory_processes.query_extensions
- decidim_assemblies.query_extensions
- decidim_initiatives.query_extensions
The issue is solved. The problem was indeed caused by the autoloader ... It seems that if you have Type A, Type C, includes Interface B , and the class (Type B) was not loaded before, then it will be evaluated twice, resulting in the error mentioned in the previous comments
Describe the bug I am trying to migrate the graphql schema of an opensource project to the Class API, however, after i have migrated all the classes to the new structure, i have started to have error like "Multiple definitions for
TranslatedField
. Previously found Decidim::Core::TranslatedFieldType (Class), then found Decidim::Core::TranslatedFieldType (Class) at ParticipatoryProcess.subtitle", which i have managed to track down to the orphan_types definitionVersions
graphql
version: 1.11.6rails
(or other framework): 5.2.4.4graphiql-rails
(1.4.11)graphlient
(0.4.0)graphql-client
(0.16.0)GraphQL schema
Include relevant types and fields (in Ruby is best, in GraphQL IDL is ok). Are you using interpreter? Any custom instrumentation, etc?
GraphQL query
Example GraphQL query and response (if query execution is involved) - The query involved is a IntrospectionQuery
Steps to reproduce Try to define 3 objects. object 1 place it as field in query, object 2 place it as orphan. Object 3 place it as field of those 2 previous objects. I am using Namespaces, so maybe a namespace issue is involved.
Expected behavior
I would have expected the query not to raise any errors, as the previous version api did not raised an error.
Actual behavior
The Grapohql is trying to redefine the type.
Place full backtrace here (if a Ruby exception is involved):
Click to view exception backtrace
``` backend-app | Multiple definitions for `TranslatedField`. Previously found Decidim::Core::TranslatedFieldType (Class), then found Decidim::Core::TranslatedFieldType (Class) at ParticipatoryProcess.subtitle backend-app | /bundle_cache/ruby/2.7.0/gems/graphql-1.11.6/lib/graphql/schema.rb:1874:in `add_type' backend-app | /bundle_cache/ruby/2.7.0/gems/graphql-1.11.6/lib/graphql/schema.rb:1896:in `block in add_type' backend-app | /bundle_cache/ruby/2.7.0/gems/graphql-1.11.6/lib/graphql/schema.rb:1892:in `each' backend-app | /bundle_cache/ruby/2.7.0/gems/graphql-1.11.6/lib/graphql/schema.rb:1892:in `add_type' backend-app | /bundle_cache/ruby/2.7.0/gems/graphql-1.11.6/lib/graphql/schema.rb:1765:in `block in add_type_and_traverse' backend-app | /bundle_cache/ruby/2.7.0/gems/graphql-1.11.6/lib/graphql/schema.rb:1765:in `each' backend-app | /bundle_cache/ruby/2.7.0/gems/graphql-1.11.6/lib/graphql/schema.rb:1765:in `add_type_and_traverse' backend-app | /bundle_cache/ruby/2.7.0/gems/graphql-1.11.6/lib/graphql/schema.rb:1375:in `orphan_types' backend-app | /code/decidim/decidim-api/app/types/decidim/api/schema.rb:16:in `Additional context The project and the bug is open source, and the entire repository can be downloaded from : https://github.com/tremend-cofe/decidim . The Pull request highlighting the changes is: https://github.com/tremend-cofe/decidim/pull/55/files
I already tried to change the namespace to something like Decidim::*::Types, but i have not seen any changes regarding this bug state.
I have also dug up in the code, and patched the schema.rb to dump some informantion: