-
Notifications
You must be signed in to change notification settings - Fork 15.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BadRequest Error on Simple Query to NotionDB Database Using notion_db_secret and database_id, due to passing empty dict in json for filter by default #18009
Comments
https://github.com/langchain-ai/langchain/blob/master/libs/community/langchain_community/document_loaders/notiondb.py#L214 causing this
to fail. notion database API supports post without filter e.g. below works.
|
Created this PR to fix it. |
I am also experiencing the same issue as described above. The behavior does not work as expected for me either. |
Same here:
|
Exactly the same issue here even with latest version |
Modified _request method in langchain/libs/community/langchain_community/document_loaders/notiondb.py to conditionally include the 'filter' key in the JSON payload only if the filter_object is provided and not empty. Related GitHub Issue: langchain-ai#18009
…g filter parameter (#19075) - **Description:** This change fixes a bug where attempts to load data from Notion using the NotionDBLoader resulted in a 400 Bad Request error. The issue was traced to the unconditional addition of an empty 'filter' object in the request payload, which Notion's API does not accept. The modification ensures that the 'filter' object is only included in the payload when it is explicitly provided and not empty, thus preventing the 400 error from occurring. - **Issue:** Fixes [#18009](#18009) - **Dependencies:** None - **Twitter handle:** @gunnzolder Co-authored-by: Anton Parkhomenko <anton@merge.rocks>
…g filter parameter (langchain-ai#19075) - **Description:** This change fixes a bug where attempts to load data from Notion using the NotionDBLoader resulted in a 400 Bad Request error. The issue was traced to the unconditional addition of an empty 'filter' object in the request payload, which Notion's API does not accept. The modification ensures that the 'filter' object is only included in the payload when it is explicitly provided and not empty, thus preventing the 400 error from occurring. - **Issue:** Fixes [langchain-ai#18009](langchain-ai#18009) - **Dependencies:** None - **Twitter handle:** @gunnzolder Co-authored-by: Anton Parkhomenko <anton@merge.rocks>
…g filter parameter (#19075) - **Description:** This change fixes a bug where attempts to load data from Notion using the NotionDBLoader resulted in a 400 Bad Request error. The issue was traced to the unconditional addition of an empty 'filter' object in the request payload, which Notion's API does not accept. The modification ensures that the 'filter' object is only included in the payload when it is explicitly provided and not empty, thus preventing the 400 error from occurring. - **Issue:** Fixes [#18009](#18009) - **Dependencies:** None - **Twitter handle:** @gunnzolder Co-authored-by: Anton Parkhomenko <anton@merge.rocks>
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
b'{"object":"error","status":400,"code":"validation_error","message":"body failed validation. Fix one:\nbody.filter.or should be defined, instead was
undefined
.\nbody.filter.and should be defined, instead wasundefined
.\nbody.filter.title should be defined, instead wasundefined
.\nbody.filter.rich_text should be defined, instead wasundefined
.\nbody.filter.number should be defined, instead wasundefined
.\nbody.filter.checkbox should be defined, instead wasundefined
.\nbody.filter.select should be defined, instead wasundefined
.\nbody.filter.multi_select should be defined, instead wasundefined
.\nbody.filter.status should be defined, instead wasundefined
.\nbody.filter.date should be defined, instead wasundefined
.\nbody.filter.people should be defined, instead wasundefined
.\nbody.filter.files should be defined, instead wasundefined
.\nbody.filter.url should be defined, instead wasundefined
.\nbody.filter.email should be defined, instead wasundefined
.\nbody.filter.phone_number should be defined, instead wasundefined
.\nbody.filter.relation should be defined, instead wasundefined
.\nbody.filter.created_by should be defined, instead wasundefined
.\nbody.filter.created_time should be defined, instead wasundefined
.\nbody.filter.last_edited_by should be defined, instead wasundefined
.\nbody.filter.last_edited_time should be defined, instead wasundefined
.\nbody.filter.formula should be defined, instead wasundefined
.\nbody.filter.unique_id should be defined, instead wasundefined
.\nbody.filter.rollup should be defined, instead wasundefined
.","request_id":"a251ecce-5757-44bf-a5f1-c4d7582d72dd"}'Description
getting 400, Bad Request
System Info
langchain==0.1.9
langchain-community==0.0.22
langchain-core==0.1.26
The text was updated successfully, but these errors were encountered: