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

Problems deploying and accessing Hasura on v1.3.2. /v1/graphql/: "You need to enable JavaScript to run this app." #6424

Closed
tkim90 opened this issue Jan 6, 2021 · 3 comments

Comments

@tkim90
Copy link

tkim90 commented Jan 6, 2021

Problem

I deployed my hasura instance on a k8s cluster, but all POST requests (to /v1/graphql/, /v1/request/, for ex) returns You need to enable JavaScript to run this app.. I'm using image hasura/graphql-engine:v1.3.2

  1. Can't access the console. Accessing mysite.com/console/ shows the "Loading..." text but nothing happens. Inspecting the network tab, I see it makes 3 POST requests to /v1/query. All 3 of them get the response You need to enable JavaScript to run this app.

  2. Can't post queries. A POST to mysite.com/v1/graphql returns:

You need to enable JavaScript to run this app.

I've tried this in the browser (firefox, chrome, safari) and via curl.


What I checked

  • I'm running hasura on dev mode (HASURA_GRAPHQL_DEV_MODE), but dont' see any hasura logs when I call POST /v1/graphql. This makes me think it's a network issue where the request can't reach the container.
  • k8s deployment passes health check and runs the hasura pod.
  • I'm using a load balancer. I made sure that all requests to /v1/graphql/* get fwded to the hasura container.

Ingress file:

// ingress.yaml

spec:
  rules:
  - host: my-site.com
    http:
      paths:
      - path: /v1/graphql/*
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /v1/query/*
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /console/*
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /healthz/*
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
@tirumaraiselvan
Copy link
Contributor

I guess the issue is that console is served in /console and there is no GET support on /v1/graphql. Although I am not sure why POSTing a valid request to /v1/graphql throws an error.

@tkim90
Copy link
Author

tkim90 commented Jan 6, 2021

Regarding Problem #1

  • You're right, GET /v1/graphql/ is not a valid endpoint (tested this locally). I'll edit the question.

Regarding Problem #2

  • I made some progress - I added /console/*, /v1/query as extra ingress paths, both pointing to the hasura container. When I access my-site.com/console/, now I get the hasura "Loading..." screen! But...it's stuck there. Inspecting network tab shows it's making a POST request to /v1/query/, but returns the same You need to enable JavaScript to run this app.. Seems related to the same issue with POST `/v1/graphql/.

@tkim90 tkim90 changed the title Problems deploying and accessing Hasura on v1.3.2. /v1/graphql/: "resource does not exist" Problems deploying and accessing Hasura on v1.3.2. /v1/graphql/: "You need to enable JavaScript to run this app." Jan 6, 2021
@tkim90
Copy link
Author

tkim90 commented Jan 6, 2021

OK, so I solved this.

The issue was with my ingress.yaml declaration. Because I'm using a load balancer, it expects me to write all the hasura endpoints by hand so it knows which paths to forward to which service (api docs).

@tirumaraiselvan I wonder, is there a way to customize my hasura instance api endpoints? I was thinking of prefixing it with a /hasura so I only declare my hasura related endpoints once in the ingress file (see below). Basically the ability to change /v1/graphql/ to /hasura/v1/graphql, etc. This is especially useful if I had multiple hasura instances in my cluster (define a path for /hasura-app-1, /hasura-app-2. I don't think there's a way to do this currently?).

Also, TIL that responses like "You need javascript to run this app." could mean "I don't know what this path is".


Final ingress.yaml

// ingress.yaml

spec:
  rules:
  - host: my-site.com
    http:
      paths:
      - path: /v1/graphql
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /v1/query
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /v1beta1/relay
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /v1alpha1/graphql
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /v1alpha1/pg_dump
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /v1alpha1/config
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /v1/graphql/explain
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /v1/version
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /healthz
        backend:
          serviceName: my-graphql-service
          servicePort: 8080
      - path: /console
        backend:
          serviceName: my-graphql-service
          servicePort: 8080

@tkim90 tkim90 closed this as completed Jan 6, 2021
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

2 participants