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

Doesn't seem to ever log SQL queries or requests #16

Open
matt-dalton opened this issue Apr 28, 2021 · 5 comments
Open

Doesn't seem to ever log SQL queries or requests #16

matt-dalton opened this issue Apr 28, 2021 · 5 comments

Comments

@matt-dalton
Copy link

I'm using this alongside django-debug-toolbar 2.2.1 and I can't seem to get any SQL queries to show up. I've followed all the install instructions, and have tried using 3.2.1 instead, nothing seems to work.

Screenshot 2021-04-28 at 17 52 11

I looked into what was going wrong in the code, and if I log here:

class DebugToolbarMiddleware(BaseMiddleware):

    def process_view(self, request, view_func, *args):
        print(view_func, hasattr(view_func, 'view_class') )
        if hasattr(view_func, 'view_class') and\
                issubclass(view_func.view_class, GraphQLView):
            request._graphql_view = True

I get <function graphql at 0x139768160> False, so it appears it's not recognising my GraphqQL views. Is there something obvious I've not configured correctly or differently on the graphQL side?

I thought it might be because I'd extended the base from graphene_django.views import GraphQLView class but I tried using the original and that still didn't seem to work.

I'm on these versions:

graphene==2.1.8
graphene-django==2.15.0
graphql-core==2.3.2
graphql-relay==2.0.1
@mawilliam
Copy link

I recently had this same issue and I ended up being able to view the queries after refreshing my browser and then looking at the history panel ("debug_toolbar.panels.history.HistoryPanel"). Click “Switch” for the most recent POST to get the data related to the query.

This is not ideal though - is there something we may be missing?

@tasiotas
Copy link

tasiotas commented May 2, 2023

same here, its there in the history. It used to work automatically, SQL was updating on each gql request.

@tasiotas
Copy link

tasiotas commented May 4, 2023

I was using callback method to display toolbar. Once I switched to INTERNAL_IPS, it working again

if DEBUG:
    INTERNAL_IPS = type(str("c"), (), {"__contains__": lambda *a: True})()

@ethagnawl
Copy link

I've tried all of the above and still can't get the output updated in real time. Is anyone aware of any other workarounds?

@ethagnawl
Copy link

I dug into this a little bit and it seems like the issue is related to the DebugToolbarMiddleware#call method. The updated data is present in its payload but it's not making its way through to the client. So, maybe something changed in the Graphene/Graphiql headers -- the middleware is checking for a _graphiql header which I don't see present in the current response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants