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.

object validation creates misleading non null error

See original GitHub issue

What is happening

A non null error is reported for a field that is not null, e.g. Cannot return null for non-nullable field Account.id.

What is really happening

When you dig into graphql code and start console.logging intermediate results, you start seeing very different things:

Scenario 1 Expected a value of type "PostRegistration" but received: "TERMS"

So, in this case, I had added a value to an ENUM field in the database but forgot to add it to the graphql enum, hence the error. Impossible to determine from the provided error message (cannot return null ...).

Scenario 2 non nullable field Account.foo was null

In this case, another required key on the same object was provided with a null value. It seems obvious, but the error message is so specific, that you can easily miss this.

In short, a whole class of field validation errors, is being aggregated to a single highly specific message that is plain wrong.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:42
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

106reactions
tedb19commented, Oct 7, 2019

any progress on this?

8reactions
nidsharcommented, Mar 31, 2020

Any updates on this one?

Read more comments on GitHub >

github_iconTop Results From Across the Web

validation error for non-null throws false error condition — oracle-tech
I am trying to perform a DML (INSERT) with a form element (textbox) that has been disabled on the form. The objective is...
Read more >
Rails strange behaviour on "not null" column - Stack Overflow
I'm just wondering which one is normal. If the first one is normal behaviour, then what's the point of checking return value of...
Read more >
Everything you wanted to know about $null - PowerShell
You can think of NULL as an unknown or empty value. A variable is NULL until you assign a value or an object...
Read more >
Understanding null safety - Dart programming language
This makes the call to requireStringNotNull() produce a compile error, which is what you ... Since Object is non-nullable now, it is no...
Read more >
Hibernate's “Not-Null Property References a Null or Transient ...
Firstly, let's discuss Hibernate's @Column(nullable = false) annotation. We can rely on Hibernate's nullability checking if no other Bean ...
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