Notion API bad gateway

Thanks @UCM_NPO_INC and @budo,

The formulas 2.0 update was very significant to the Notion architecture and I’m not surprised we’re seeing some challenges like this. I am certainly following up with them directly. Hopefully we get a resolution soon.

2 Likes

Hello everyone @here

I just wanted to let you know that the Notion team messaged us with some good news. They’ve implemented a series of changes and fixes on their end, and everything should now be back up and running.

Please go ahead and test everything out for yourselves to see. :pray:

1 Like

I am still having trouble with databases that have long or many formulas where it still times out using Make’s Watch Database option. It seems that if there are many items that have been updated since the last run, it will fail.

The only workaround, if you have a large database or lots of formulas, that I have been able to get working consistently is to do an API call to the query endpoint (/v1/database//query) with a filter like:

{
  "filter": {
    "timestamp": "last_edited_time",
    "last_edited_time": {
      "on_or_after": "{{addHours(now; -1)}}"  
    }
  }
}

And have the scenario run within the timeframe that you’ve specified. There are some caveats with this method: this method doesn’t know if the scenario has already run with the same data (so it may mean calling the same items over and over again) until the last_edited_time gets past the threshold you specify above (so it might consume more operations). It’s also not bulletproof - I will still get timeouts if I edit many items at the same time (looks like 25 might be the cutoff - but I have had it fail with a few less).

Hi @Michaela ,

Thank you very much for the follow up.

I also received a message from Notion a few days ago, mentioning that they had released certain updates, but this is the same as for @segleaur : for databases that have several formulas or more columns (40+), I still have the timeout errors if I don’t use the workaround that I described earlier in this conversation. The issue comes from the Watch database module mainly.

Notion support also told me the ticket is still in review, so hopefully there will be other improvements to come. :slight_smile:

Thank you so much for keeping us updated on your progress @segleaur @UCM_NPO_INC :pray:

I’m sure the Notion team will deploy all the remaining fixes as soon as possible and all will be working as desired again :crossed_fingers:

2 Likes

Hiya @UCM_NPO_INC, you’d use the “Make an API Call” call module to do this. In the URL, you’d use the /v1/database endpoint with something like:

/v1/databases/<databaseId>/query

I’m using Notion’s API version 2022-06-28.
Note that this is a POST request, so you’ll have to change the GET to POST for this to work.
And in the body, you would use something similar to the filter above. The “addHours” is Make’s internal function, so you can specify Days, Hours, Minutes, Seconds, and use a negative number to look into the past.

The next module needs to be an iterator to build the bundles so the down stream modules can handle the data easily. That iterator is going to take body.results (that you select from the API response) to build those bundles.

After that, build the rest of the flow as you normally would. Instead of pulling the data from your “Watch Database” module, you’ll be pulling it from the iterator. You may have to run the scenario with just the “Make an API Call” and the Iterator to pre-populate the array.

Let me know if this helps.

2 Likes

Hi @segleaur , thanks a lot for all the explanations! :slight_smile:

I just have a question for the URL, because for now I have a [400] Invalid request URL error.
All is fine with the database ID, but not sure about the rest of the path.

If you can just help me find the right URL, this would be very appreciated. :pray:

Thank you again for your help!

2 Likes

There was a typo in the endpoint: it’s /v1/databases/query

(Notion /v1/databases/ endpoint reference)

Wonderful, thank you @segleaur , this works very well for now with a database that was stuck with the timeout errors, because it contains quite a lot of formula and columns.

Your workaround allows me to avoid to create another database in order to process the formulas, this is very appreciated. :slight_smile: