Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 error on /graphql if no databases attached #64

Closed
simonw opened this issue Nov 10, 2020 · 0 comments
Closed

500 error on /graphql if no databases attached #64

simonw opened this issue Nov 10, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Nov 10, 2020

Very unimportant bug, but if you visit /graphql on an instance of Datasette started using datasette . without any attached databases you get this:

  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/datasette/app.py", line 1033, in route_path
    response = await view(request, send)
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/datasette/app.py", line 1204, in async_view_fn
    response = await async_call_with_supported_arguments(
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/datasette/utils/__init__.py", line 915, in async_call_with_supported_arguments
    return await fn(*call_with)
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/datasette_graphql/__init__.py", line 69, in view_graphql
    schema = await schema_for_database_via_cache(datasette, database=database)
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/datasette_graphql/utils.py", line 72, in schema_for_database_via_cache
    schema = await schema_for_database(datasette, database)
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/datasette_graphql/utils.py", line 222, in schema_for_database
    return graphene.Schema(
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphene/types/schema.py", line 78, in __init__
    self.build_typemap()
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphene/types/schema.py", line 167, in build_typemap
    self._type_map = TypeMap(
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphene/types/typemap.py", line 80, in __init__
    super(TypeMap, self).__init__(types)
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphql/type/typemap.py", line 31, in __init__
    self.update(reduce(self.reducer, types, OrderedDict()))  # type: ignore
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphene/types/typemap.py", line 88, in reducer
    return self.graphene_reducer(map, type)
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphene/types/typemap.py", line 117, in graphene_reducer
    return GraphQLTypeMap.reducer(map, internal_type)
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphql/type/typemap.py", line 109, in reducer
    field_map = type_.fields
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphql/pyutils/cached_property.py", line 22, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphql/type/definition.py", line 198, in fields
    return define_field_map(self, self._fields)
  File "/usr/local/Cellar/datasette/0.50.2/libexec/lib/python3.9/site-packages/graphql/type/definition.py", line 214, in define_field_map
    assert isinstance(field_map, Mapping) and len(field_map) > 0, (
AssertionError: Query fields must be a mapping (dict / OrderedDict) with field names as keys or a function which returns such a mapping.
@simonw simonw added the bug Something isn't working label Nov 10, 2020
@simonw simonw closed this as completed in 69eaab1 Nov 21, 2020
simonw added a commit that referenced this issue Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant