question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Graphql error: enum type does not exist because case sensitivity was not recognized

See original GitHub issue

I have an existing postgres DB with an enum (native Postgres enum type) named “enum_Motivations_desired_solution” on a table named “Motivations”. When I try to insert into the table, Hasura throws an error indicating it is looking for an enum of the same name but in lower case. If I re-name the enum in Postgres to be lower case, it solves the problem. The error: { “errors”: [ { “extensions”: { “path”: “$.selectionSet.insert_Interactions.args.objects[0].Motivations.data”, “code”: “constraint-error” }, “message”: “type "enum_motivations_desired_solution" does not exist” } ] }

The query:

mutation InteractionTest {
  insert_Interactions(objects: [
    {
      OwnerId: 5,
      forUserId: 1,
      initiatedByUserId: 1,
      Motivations: {
      data: [
        {
          desired_solution: "solution A",
          MotivatingFactors: {
            data: [{
              isCurrentFactor: true,
              commonFactor: "A"
            },
            {
              isCurrentFactor: true,
              commonFactor: "B"
            }]
          }
        }
      ]
    }
    }
  ]) {
    affected_rows
    returning {
      Motivations {
        desired_solution
        MotivatingFactors {
          commonFactor
          isCurrentFactor
        }
      }
    }
  }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rakeshkkycommented, Apr 12, 2022

Hi @gentleShark , thank you for the detailed bug report, and for your patience whilst we fix it. I’m happy to say this has been fixed at https://github.com/hasura/graphql-engine/commit/d5610242542eb10c8d3ba825f2bd34fb23fb4faf, and will be available in the next stable release within two weeks.

1reaction
rakeshkkycommented, Mar 31, 2022

Additional context: We don’t generate GraphQL enum types out of Postgres enums instead we generate simple custom scalar type. We treat them as Unknown type and insert data with String literals ('').

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling - Apollo GraphQL Docs
A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ...
Read more >
What you need to know about GraphQL enums
Our query is now safe, typoless, and fully discoverable. GraphQL Enums TypeScript Types Generation. But the enum value as String is not valid....
Read more >
Index an enum object with case-insensitive key in TypeScript
The short answer is that you can't and you need to work around it. ... might be very confused, since they'd be expecting...
Read more >
Postgres: Enum type fields | Hasura GraphQL Docs
Enum type fields are restricted to a fixed set of allowed values. ... native enum types have significant drawbacks: they are not easily...
Read more >
GraphQL specification
GraphQL does not mandate a particular programming language or storage system ... GraphQL offers an Enum type in those cases, where the type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found