hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.18k stars 2.77k forks source link

Console: "Expected value of type geography" when inserting point #3272

Open afreix opened 5 years ago

afreix commented 5 years ago

Hello hasura team,

I have a table created by running the following command

CREATE TABLE "testPlaceDetails" (
  id SERIAL PRIMARY KEY,
  name TEXT,
  type TEXT,
  location GEOGRAPHY(Point)
)

when trying to insert via the console, I get an error "Expected value of type geography" for the location property

{
  "object": {
    "name": "Eiffel Tower",
    "location": {
      "point": {
        "type": "Point",
        "coordinates": [1,1]
      }
    }
  }
}

when I go into the explorer tab, I see that location is of type geography, but clicking into geography brings me to a blank screen.

I've also executed the follow SQL commands in the SQL tab on the console

CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;

as mentioned here: https://blog.hasura.io/graphql-and-geo-location-on-postgres-using-hasura-562e7bd47a2f/

Based on the docs I would have expected this to work

rikinsk commented 5 years ago

I believe you have an extra field point in your geography representation.

Could you try the query with the following object instead

{
  "object": {
    "name": "Eiffel Tower",
    "location": {
      "type": "Point",
      "coordinates": [1,1]
    }
  }
}
afreix commented 5 years ago

Ah you're right. I tried that as well, and I'm still seeing the error. Luckily, the mutation still works (despite seeing an error in the console), so it looks like this is a pretty minor bug

Thanks for the help!

sangdth commented 3 years ago

I'm still seeing the error today. ~And it doesn't allow me to execute the mutation.~ Ah I can insert it despite the error showing...

~How can I overcome this issue?~

Screenshot 2020-12-11 at 21 24 15
alexander-mart commented 2 years ago

@rikinsk This error from GraphQL console is still actual. Hasura version: v2.2.0 https://github.com/hasura/graphql-engine/issues/3272#issuecomment-743382617

valentin-harrang commented 2 years ago

Same error

thanush commented 2 years ago

it's working fine even with the error.

Knorway commented 2 years ago

same here. it works but still displays the error