Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Problem: The search function is currently broken: we get a mysterious 405 error when we prop open the dev console and inspect the search request:
It turns out that Notion slightly changed the API for search, resulting in the way the library
notion-client
sends the API request to Notion for searching to be broken and throw an error:The request body in the above screenshot was generated by
notion-client
and I just put it in Postman to show the error that is thrown by the Notion API.Luckily this was a quick fix! I went to Notion and performed a search and inspected how they sent the API request, and noticed a slight difference:
For the
sort
key,notion-client
currently sends the following:While the Notion web app sends:
So I changed
notion-client
to send thesort
the same way the Notion web app sends it (which you can see in the code of this pull request) and the search function started working again!Notion Test Page ID
cebbcc4b7b784d63819ef7db02054b49