5

I am making successful calls to query a Notion Database, but the data that I am getting from the API call is just not consistent with the actual data from Notion.

I've been pulling my hair out, as I can't figure out what could possibly be causing the inconsistency. Am I doing anything wrong here?

Here is the filter that I am using on the query:

const filter = {
  property: '_Inbox?',
  formula: {
    checkbox: {
      equals: true,
    },
  },
}

The problem is that the response returns me many results for which the formula actually returns false in Notion. Here is an example:

Sample item properties in Notion

Same item inside the API Response

Everything else seems to work fine, apart from that data inconsistency with formulas. It doesn't seem to be a cache issue either as I also get old items for which the formula doesn't match.

Any help would be greatly appreciated. Or at least a confirmation that I'm not crazy and that there is an issue with the Notion API?

Cheers

tonigiri
  • 147
  • 6

1 Answers1

7

Omg finally found out the issue right after posting the question...

If anyone is facing something like this, the reason is that the formula was referencing relation props, that the API didn't have access to ‍♂️

If the Notion team is reading this, I would highly recommend to omit the property instead of silently making it return an incorrect value. An explicit warning would be best, but a missing value would at least make debugging and spotting the issue a little bit easier.

tonigiri
  • 147
  • 6
  • 1
    Didn't have access to ‍♂️? What's that? – ouflak Sep 19 '21 at 10:33
  • 3
    Relation properties that the API didn't have access to. Basically, if you're having the same issue, you should look at the formula, and see if it refers to relation props. If it does, go to the database for that relation, and share it with your integration. – tonigiri Sep 20 '21 at 11:09
  • 1
    Thank you for posting this! Finally got it working after an hour of debugging! – Ali Tarraf Sep 28 '22 at 19:22
  • THANK YOU! If the integration you've built doesn't have access to the related database, then the relation query will return nothing. It would be awesome if it threw an error or something instead.... – Tony McKendry Jan 02 '23 at 21:47
  • It's 30/Jan/23 and the thing is still the same. Thanks. One note that, we can use the right value in the filter of the request but the return is still a wrong value. But it's not a problem for me, I just need it for the filter. – Anh-Thi DINH Jan 29 '23 at 23:02
  • Thank you! You saved me hours of debugging! That's a crazy bug and I wonder why it's not getting fixed. For me, I got the "true" value for some boolean props. – Dmitrii Babich Jun 18 '23 at 11:38