langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
45.52k stars 6.4k forks source link

Knowledge base Notion Intergration err #7894

Closed iray1991 closed 1 week ago

iray1991 commented 1 week ago

Self Checks

Dify version

Dify 0.7.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When linking Notion to dify in the knowlege base seesion , the link went to https://[api.notion.com/v1/oauth/authorize?client_id=&response_type=code&redirect_uri=%2Fconsole%2Fapi%2Foauth%2Fdata-source%2Fcallback%2Fnotion&owner=user](https://api.notion.com/v1/oauth/authorize?client_id=&response_type=code&redirect_uri=%2Fconsole%2Fapi%2Foauth%2Fdata-source%2Fcallback%2Fnotion&owner=user)

showes

{ "error": "invalid_request", "error_description": "query failed validation: query.client_id should be a string or undefined, instead was 0.", "request_id": "d765f8e9-96bd-41a7-8fcb-4bd5595c1a55" }

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

dosubot[bot] commented 1 week ago

I found two similar discussions that might be relevant to your issue:

  1. Error when adding Notion data source in the community version of Dify (open) [1].
  2. Can't connect to Notion (open) [2].

To resolve the "invalid_request" error when linking Notion to Dify, which states "query.client_id should be a string or undefined, instead was 0", ensure that the NOTION_CLIENT_ID environment variable is correctly set in your .env file. The environment variables should be configured as follows:

For a public integration:

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

Make sure that NOTION_CLIENT_ID is set to a valid string value (your actual client ID) and not 0. This should resolve the error. Additionally, ensure that you have followed the correct steps to upgrade your internal integration to a public integration by navigating to the Distribution page of the integration, toggling the switch to make the integration public, and filling out the necessary information in the Organization Information form. After successfully making the integration public, you will be able to access the integration key in the Keys tab and complete the configuration in your .env file.

For an internal integration:

NOTION_INTEGRATION_TYPE=internal
NOTION_INTERNAL_SECRET=your-internal-secret

Ensure that the NOTION_INTERNAL_SECRET is correctly set if you are using an internal integration. This should also be a valid string value. Follow the steps to create an internal integration by navigating to the integration settings and creating a new integration, which will be internal by default [3][4][5].

To continue talking to Dosu, mention @dosu.

crazywoola commented 1 week ago

What does your client id look like?

https://[api.notion.com/v1/oauth/authorize?client_id=&response_type=code&redirect_uri=%2Fconsole%2Fapi%2Foauth%2Fdata-source%2Fcallback%2Fnotion&owner=user](https://api.notion.com/v1/oauth/authorize?client_id=&response_type=code&redirect_uri=%2Fconsole%2Fapi%2Foauth%2Fdata-source%2Fcallback%2Fnotion&owner=user)

It seems you haven't set this environment variable from the link you provided.