Found different types with the same name in the schema: ErrorType, ErrorType.
KINGH242 opened this issue · comments
I have installed django-graphql-auth with the latest version of graphene-django, but I get the above error because of duplicate types with the same name. ErrorType in graphql_auth/types.py clashes with ErrorType in graphene_django/types.py. I want to use this package in a project, but this here is blocking me.
Please print the error traceback.
Traceback (most recent call last):
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/contrib/staticfiles/handlers.py", line 65, in __call__
return self.application(environ, start_response)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/core/handlers/wsgi.py", line 141, in __call__
response = self.get_response(request)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/core/handlers/base.py", line 75, in get_response
response = self._middleware_chain(request)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/core/handlers/exception.py", line 36, in inner
response = response_for_exception(request, exc)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/core/handlers/exception.py", line 125, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django_extensions/management/technical_response.py", line 37, in null_technical_500_response
six.reraise(exc_type, exc_value, tb)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/six.py", line 702, in reraise
raise value.with_traceback(tb)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql_jwt/decorators.py", line 122, in wrapped_view
response = view_func(request, *args, **kwargs)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/django/views/generic/base.py", line 62, in view
self = cls(**initkwargs)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene_django/views.py", line 79, in __init__
schema = graphene_settings.SCHEMA
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene_django/settings.py", line 117, in __getattr__
val = perform_import(val, attr)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene_django/settings.py", line 56, in perform_import
return import_from_string(val, setting_name)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene_django/settings.py", line 70, in import_from_string
module = importlib.import_module(module_path)
File "/Users/hareemadderley/.pyenv/versions/3.7.5/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Volumes/Macintosh HD - Data/Projects/Clients/What2Do Bahamas/project_config/schema.py", line 15, in <module>
schema = Schema(query=Query, mutation=Mutation)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/schema.py", line 78, in __init__
self.build_typemap()
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/schema.py", line 168, in build_typemap
initial_types, auto_camelcase=self.auto_camelcase, schema=self
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 80, in __init__
super(TypeMap, self).__init__(types)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql/type/typemap.py", line 28, in __init__
self.update(reduce(self.reducer, types, OrderedDict())) # type: ignore
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 88, in reducer
return self.graphene_reducer(map, type)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 117, in graphene_reducer
return GraphQLTypeMap.reducer(map, internal_type)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql/type/typemap.py", line 106, in reducer
field_map = type.fields
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql/pyutils/cached_property.py", line 22, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql/type/definition.py", line 226, in fields
return define_field_map(self, self._fields)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql/type/definition.py", line 240, in define_field_map
field_map = field_map()
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 275, in construct_fields_for_type
map = self.reducer(map, field.type)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 88, in reducer
return self.graphene_reducer(map, type)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 117, in graphene_reducer
return GraphQLTypeMap.reducer(map, internal_type)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql/type/typemap.py", line 106, in reducer
field_map = type.fields
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql/pyutils/cached_property.py", line 22, in __get__
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql/type/definition.py", line 226, in fields
return define_field_map(self, self._fields)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphql/type/definition.py", line 240, in define_field_map
field_map = field_map()
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 275, in construct_fields_for_type
map = self.reducer(map, field.type)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 88, in reducer
return self.graphene_reducer(map, type)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 93, in graphene_reducer
return self.reducer(map, type.of_type)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 88, in reducer
return self.graphene_reducer(map, type)
File "/Users/hareemadderley/.local/share/virtualenvs/What2Do_Bahamas-lDSvnZ_Z/lib/python3.7/site-packages/graphene/types/typemap.py", line 99, in graphene_reducer
).format(_type.graphene_type, type)
AssertionError: Found different types with the same name in the schema: ErrorType, ErrorType.
graphql-python/graphene-django#539 (comment) maybe related.
To investigate further I will need the steps to reproduce it, but I don't see the graphql_auth
in the traceback, it's probably more a graphene_django
issue. Did manage to complete the quickstart? Do you get this error if you uninstall graphql_auth
?
If I uninstall graphql_auth or remove the mutations from the schema, the error goes away. It seems to be because of the ErrorType class, which is the same name as the ErrorType class for graphene_django. When graphene runs its reducer function, it crashes because it finds two classes in the schema which have the same name....the ErrorType class.
This is what the output of pip freeze
aniso8601==7.0.0
appdirs==1.4.3
asgiref==3.2.3
astroid==2.3.3
Babel==2.8.0
cachetools==4.0.0
certifi==2019.11.28
chardet==3.0.4
Click==7.0
defusedxml==0.6.0
distlib==0.3.0
dj-stripe==2.2.3
Django==2.2.3
django-admin-hstore-widget==1.1.0
django-admin-sortable==2.2.3
django-cors-headers==3.2.1
django-debug-toolbar==2.2
django-environ==0.4.5
django-extensions==2.2.8
django-feedparser==0.2.1
django-filer==1.7.0
django-filter==2.2.0
django-graphql-auth==0.3.3
django-graphql-jwt==0.3.0
django-guardian==2.2.0
django-hosts==4.0
django-jet==1.0.8
django-js-asset==1.2.2
django-mptt==0.10.0
django-mptt-admin==0.7.1
django-phonenumber-field==4.0.0
django-polymorphic==2.1.2
django-recaptcha3==0.1.0
django-sendgrid-v5==0.8.1
django-solo==1.1.3
django-storages==1.9.1
django-tagging==0.4.6
django-tinymce==2.8.0
django-webpack-loader==0.7.0
easy-thumbnails==2.7
Faker==4.0.1
feedparser==5.2.1
filelock==3.0.12
future==0.18.2
google-api-core==1.16.0
google-api-python-client==1.7.11
google-auth==1.11.2
google-auth-httplib2==0.0.3
google-cloud==0.34.0
google-cloud-core==1.3.0
google-cloud-logging==1.15.0
google-cloud-secret-manager==0.1.1
google-cloud-storage==1.26.0
google-resumable-media==0.5.0
googleapis-common-protos==1.51.0
graphene==2.1.8
graphene-django==2.8.2
graphql-core==2.3.1
graphql-relay==2.0.1
grpc-google-iam-v1==0.12.3
grpcio==1.27.2
handsdown==0.3.8
httplib2==0.17.0
idna==2.9
importlib-metadata==1.5.0
iso8601==0.1.12
isort==4.3.21
Jinja2==2.11.1
jsonfield==3.1.0
jsonfield2==4.0.0
lazy-object-proxy==1.4.3
livereload==2.6.1
lunr==0.5.6
Markdown==3.2.1
MarkupSafe==1.1.1
mccabe==0.6.1
mkdocs==1.1
nltk==3.4.5
oauthlib==3.1.0
pbr==5.4.4
phonenumberslite==8.11.5
Pillow==7.0.0
pipenv==2018.11.26
pipenv-to-requirements==0.9.0
promise==2.3
protobuf==3.11.3
psycopg2-binary==2.8.4
pyasn1==0.4.8
pyasn1-modules==0.2.8
Pygments==2.5.2
PyJWT==1.7.1
pylint==2.4.4
pylint-django==2.0.14
pylint-plugin-utils==0.6
pystache==0.5.4
python-dateutil==2.8.1
python-http-client==3.2.5
python-memcached==1.59
python3-openid==3.1.0
pytz==2019.3
PyYAML==5.3
requests==2.23.0
requests-oauthlib==1.3.0
rsa==4.0
Rx==1.6.1
selenium==3.141.0
sendgrid==6.1.2
singledispatch==3.4.0.3
six==1.14.0
smartypants==2.0.1
social-auth-app-django==3.1.0
social-auth-core==3.2.0
sqlparse==0.3.1
stripe==2.43.0
text-unidecode==1.3
tornado==6.0.4
typed-ast==1.4.1
Unidecode==1.1.1
uritemplate==3.0.1
urllib3==1.25.8
v==0.0.0
virtualenv==20.0.8
virtualenv-clone==0.5.3
Werkzeug==1.0.0
wrapt==1.11.2
zipp==3.1.0
I've just released the 0.3.4
version, try it :) You can see it here. Now it's probably fixed, please let me know if you keep experiencing the issue again, so I reopen it.
I have just tested 0.3.4
out in my project and it works fine now.
Thanks much for the update. The effort is appreciated.