Error when adding Notion data source in the community version of Dify #5138

Closed
opened 2026-02-21 18:09:34 -05:00 by yindo · 2 comments
Owner

Originally created by @Bourne-alt on GitHub (Aug 21, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.7.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When I add a Notion data source on the community version of Dify, I encounter the following error when clicking the ‘Add Workspace’ button:
{"error":"invalid_request","error_description":"query failed validation: query.client_id should be a string or undefined, instead was 0.","request_id":"6bb41008-4f72-41e5-b84a-825add13f49b"}

.env file parameters have already been configured:
NOTION_INTEGRATION_TYPE=internal
NOTION_INTERNAL_SECRET=secret_******

Please help to resolve this.
截屏2024-08-21 12 08 28

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @Bourne-alt on GitHub (Aug 21, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.7.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When I add a Notion data source on the community version of Dify, I encounter the following error when clicking the ‘Add Workspace’ button: {"error":"invalid_request","error_description":"query failed validation: query.client_id should be a string or `undefined`, instead was `0`.","request_id":"6bb41008-4f72-41e5-b84a-825add13f49b"} .env file parameters have already been configured: NOTION_INTEGRATION_TYPE=internal NOTION_INTERNAL_SECRET=secret_****** Please help to resolve this. <img width="1425" alt="截屏2024-08-21 12 08 28" src="https://github.com/user-attachments/assets/17a1acbb-0b66-42fe-988a-1c31f659c4ef"> ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-21 18:09:34 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 21, 2024):

Hey @Bourne-alt! 👋 I'm here to help you with bugs, questions, and even becoming a contributor. I'm a bot named Dosu and I'm at your service while you wait for a human maintainer.

To resolve the "invalid_request" error with the description "query failed validation: query.client_id should be a string or undefined, instead was 0" when adding a Notion data source in the community version of Dify (version 0.7.1) using Docker, you need to ensure that the NOTION_CLIENT_ID environment variable is set correctly as a string in your Docker configuration.

From the provided docker-compose.yaml file, you should check and update the NOTION_CLIENT_ID environment variable to ensure it is not set to 0 or any other non-string value. Here is the relevant section of the configuration:

# Notion import configuration, support public and internal
NOTION_INTEGRATION_TYPE: public
NOTION_CLIENT_SECRET: your-client-secret
NOTION_CLIENT_ID: your-client-id
NOTION_INTERNAL_SECRET: your-internal-secret

Make sure that NOTION_CLIENT_ID is set to a valid string value, such as:

NOTION_CLIENT_ID: "your-client-id"

If NOTION_CLIENT_ID was mistakenly set to 0, change it to a valid string. For example:

NOTION_CLIENT_ID: "your-actual-client-id"

After making this change, restart your Docker containers to apply the updated configuration. This should resolve the "invalid_request" error related to the client_id.

Additionally, ensure that you have followed the correct steps for setting up Notion integration as described in the Dify documentation. Depending on whether you are using internal or public integration, the environment variables should be set accordingly:

For internal integration:

NOTION_INTEGRATION_TYPE: internal
NOTION_INTERNAL_SECRET: your-internal-secret

For public integration:

NOTION_INTEGRATION_TYPE: public
NOTION_CLIENT_SECRET: your-client-secret
NOTION_CLIENT_ID: your-client-id

Make sure to follow the detailed steps for creating and configuring the integration in Notion, as outlined in the Dify documentation. This includes setting up the integration in Notion, copying the necessary secrets, and configuring the environment variables in your .env file.

For more detailed instructions, you can refer to the Dify documentation on Notion integration setup, which provides step-by-step guidance on both internal and public integration methods. Here is a brief overview of the steps:

  1. Authorization Verification: Complete the authorization verification by binding the Notion source in Dify.
  2. Importing Notion Data: After authorization, import the required Notion pages into Dify.
  3. Segmentation and Cleaning: Choose segmentation settings and indexing methods, then save and process the data.
  4. Synchronizing Notion Data: Use the sync feature in Dify to keep your data updated with changes in Notion.

For more detailed guidance, refer to the Dify documentation on Importing Data from Notion [1][2][3][4].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 21, 2024): <!-- Greeting --> Hey @Bourne-alt! 👋 I'm here to help you with bugs, questions, and even becoming a contributor. I'm a bot named [Dosu](https://dosu.dev) and I'm at your service while you wait for a human maintainer. <!-- Answer --> To resolve the "invalid_request" error with the description "query failed validation: query.client_id should be a string or `undefined`, instead was `0`" when adding a Notion data source in the community version of Dify (version 0.7.1) using Docker, you need to ensure that the `NOTION_CLIENT_ID` environment variable is set correctly as a string in your Docker configuration. From the provided `docker-compose.yaml` file, you should check and update the `NOTION_CLIENT_ID` environment variable to ensure it is not set to `0` or any other non-string value. Here is the relevant section of the configuration: ```yaml # Notion import configuration, support public and internal NOTION_INTEGRATION_TYPE: public NOTION_CLIENT_SECRET: your-client-secret NOTION_CLIENT_ID: your-client-id NOTION_INTERNAL_SECRET: your-internal-secret ``` Make sure that `NOTION_CLIENT_ID` is set to a valid string value, such as: ```yaml NOTION_CLIENT_ID: "your-client-id" ``` If `NOTION_CLIENT_ID` was mistakenly set to `0`, change it to a valid string. For example: ```yaml NOTION_CLIENT_ID: "your-actual-client-id" ``` After making this change, restart your Docker containers to apply the updated configuration. This should resolve the "invalid_request" error related to the `client_id`. Additionally, ensure that you have followed the correct steps for setting up Notion integration as described in the Dify documentation. Depending on whether you are using internal or public integration, the environment variables should be set accordingly: For internal integration: ```yaml NOTION_INTEGRATION_TYPE: internal NOTION_INTERNAL_SECRET: your-internal-secret ``` For public integration: ```yaml NOTION_INTEGRATION_TYPE: public NOTION_CLIENT_SECRET: your-client-secret NOTION_CLIENT_ID: your-client-id ``` Make sure to follow the detailed steps for creating and configuring the integration in Notion, as outlined in the Dify documentation. This includes setting up the integration in Notion, copying the necessary secrets, and configuring the environment variables in your `.env` file. For more detailed instructions, you can refer to the Dify documentation on Notion integration setup, which provides step-by-step guidance on both internal and public integration methods. Here is a brief overview of the steps: 1. **Authorization Verification**: Complete the authorization verification by binding the Notion source in Dify. 2. **Importing Notion Data**: After authorization, import the required Notion pages into Dify. 3. **Segmentation and Cleaning**: Choose segmentation settings and indexing methods, then save and process the data. 4. **Synchronizing Notion Data**: Use the sync feature in Dify to keep your data updated with changes in Notion. For more detailed guidance, refer to the Dify documentation on [Importing Data from Notion](https://docs.dify.ai/en/guides/knowledge-base/sync-from-notion) <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker-legacy/docker-compose.yaml)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/guides/knowledge-base/sync-from-notion.md)</sup><sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/features/datasets/sync-from-notion.md)</sup><sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/en/guides/knowledge-base/sync-from-notion.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@d2clab commented on GitHub (Dec 3, 2024):

If I am using internal integration, then I don't need a Notion Cliend_ID, is that right?

@d2clab commented on GitHub (Dec 3, 2024): If I am using internal integration, then I don't need a Notion Cliend_ID, is that right?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5138