Self-hosted Dify cannot connect Notion "Internal Server Error" #5443

Closed
opened 2026-02-21 18:10:59 -05:00 by yindo · 11 comments
Owner

Originally created by @ryoheiszk on GitHub (Sep 7, 2024).

Originally assigned to: @crazywoola on GitHub.

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.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Make Notion internal integration at https://www.notion.so/profile/integrations
  2. Apply connect Notion database to the integration.
  3. edit dify/docker/.env (integration type, key)
  4. Open Dify datasource setting
  5. click Notion option

✔️ Expected Behavior

No response

Actual Behavior

Internal Server Error

2024-09-08_04h09_13

api-1         | 2024-09-07 18:53:44,071.071 ERROR [Dummy-1] [app.py:838] - Exception on /console/api/oauth/data-source/notion [GET]
api-1         | Traceback (most recent call last):
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
api-1         |     rv = self.dispatch_request()
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
api-1         |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper
api-1         |     resp = resource(*args, **kwargs)
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view
api-1         |     return current_app.ensure_sync(self.dispatch_request)(**kwargs)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
api-1         |     resp = meth(*args, **kwargs)
api-1         |   File "/app/api/controllers/console/auth/data_source_oauth.py", line 45, in get
api-1         |     oauth_provider.save_internal_access_token(internal_secret)
api-1         |   File "/app/api/libs/oauth_data_source.py", line 88, in save_internal_access_token
api-1         |     pages = self.get_authorized_pages(access_token)
api-1         |   File "/app/api/libs/oauth_data_source.py", line 171, in get_authorized_pages
api-1         |     parent_id = self.notion_block_parent_page_id(access_token, parent[parent_type])
api-1         |   File "/app/api/libs/oauth_data_source.py", line 238, in notion_block_parent_page_id
api-1         |     parent = response_json["parent"]
api-1         | KeyError: 'parent'
Originally created by @ryoheiszk on GitHub (Sep 7, 2024). Originally assigned to: @crazywoola on GitHub. ### 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.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Make Notion internal integration at https://www.notion.so/profile/integrations 2. Apply connect Notion database to the integration. 3. edit dify/docker/.env (integration type, key) 4. Open Dify datasource setting 5. click Notion option ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior Internal Server Error ![2024-09-08_04h09_13](https://github.com/user-attachments/assets/921f1396-9af7-4346-b4a8-b2845bd8ebef) ``` api-1 | 2024-09-07 18:53:44,071.071 ERROR [Dummy-1] [app.py:838] - Exception on /console/api/oauth/data-source/notion [GET] api-1 | Traceback (most recent call last): api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request api-1 | rv = self.dispatch_request() api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request api-1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper api-1 | resp = resource(*args, **kwargs) api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view api-1 | return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request api-1 | resp = meth(*args, **kwargs) api-1 | File "/app/api/controllers/console/auth/data_source_oauth.py", line 45, in get api-1 | oauth_provider.save_internal_access_token(internal_secret) api-1 | File "/app/api/libs/oauth_data_source.py", line 88, in save_internal_access_token api-1 | pages = self.get_authorized_pages(access_token) api-1 | File "/app/api/libs/oauth_data_source.py", line 171, in get_authorized_pages api-1 | parent_id = self.notion_block_parent_page_id(access_token, parent[parent_type]) api-1 | File "/app/api/libs/oauth_data_source.py", line 238, in notion_block_parent_page_id api-1 | parent = response_json["parent"] api-1 | KeyError: 'parent' ```
yindo added the 🐞 bug label 2026-02-21 18:10:59 -05:00
yindo closed this issue 2026-02-21 18:10:59 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 7, 2024):

Hey there, @ryoheiszk! I'm here to help you with any bugs, questions, or contributions you have for the Dify project. Let's tackle this issue together!

I found some similar issues and discussions related to the "Internal Server Error" when connecting to Notion in the self-hosted version of Dify:

  1. Error when adding Notion data source in the community version of Dify (Open) [1]
  2. Can't connect to Notion (Open) [2]
  3. Encountered 'Internal Server Error' when setting NOTION_INTEGRATION_TYPE to 'internal' and providing a SECRET (Closed) [3]

For the closed issue, the suggested solution was to ensure that the environment variables are correctly configured in the .env file:

NOTION_INTEGRATION_TYPE=internal
NOTION_INTERNAL_SECRET=your-internal-secret

Make sure that your-internal-secret is the correct secret copied from the Notion integration settings under the Capabilities tab. If the error persists, double-check that the secret is correctly copied and that there are no extra spaces or characters.

Additionally, ensure that you have followed the steps to create an internal integration in Notion:

  1. Go to the Notion integration settings and click on "New integration".
  2. The type should be set to "Internal" by default.
  3. Select the associated workspace, enter the integration name, and upload a logo if desired.
  4. Click "Submit" to create the integration.
  5. In the Capabilities tab, update the settings as needed and click "Show" under Secrets to copy the secret.

After copying the secret, paste it into the .env file as shown above. This should resolve the 'Internal Server Error' [3].

If the issue persists, ensure that other essential environment variables are set correctly, such as CONSOLE_API_URL, CONSOLE_WEB_URL, SERVICE_API_URL, and APP_API_URL, as these are used to construct various URLs and configurations within the application [4][5][6].

For further troubleshooting, you can refer to the Self Host / Local Deployment Frequently Asked Questions (FAQs) which provides additional insights and solutions for common issues encountered during local deployment [7].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 7, 2024): <!-- Greeting --> Hey there, @ryoheiszk! I'm here to help you with any bugs, questions, or contributions you have for the Dify project. Let's tackle this issue together! <!-- Answer --> I found some similar issues and discussions related to the "Internal Server Error" when connecting to Notion in the self-hosted version of Dify: 1. **[Error when adding Notion data source in the community version of Dify](https://github.com/langgenius/dify/discussions/7478)** (Open) <sup>[[1]](https://github.com/langgenius/dify/discussions/7478)</sup> 2. **[Can't connect to Notion](https://github.com/langgenius/dify/discussions/6300)** (Open) <sup>[[2]](https://github.com/langgenius/dify/discussions/6300)</sup> 3. **[Encountered 'Internal Server Error' when setting NOTION_INTEGRATION_TYPE to 'internal' and providing a SECRET](https://github.com/langgenius/dify/issues/6840)** (Closed) <sup>[[3]](https://github.com/langgenius/dify/issues/6840)</sup> For the closed issue, the suggested solution was to ensure that the environment variables are correctly configured in the `.env` file: ```env NOTION_INTEGRATION_TYPE=internal NOTION_INTERNAL_SECRET=your-internal-secret ``` Make sure that `your-internal-secret` is the correct secret copied from the Notion integration settings under the Capabilities tab. If the error persists, double-check that the secret is correctly copied and that there are no extra spaces or characters. Additionally, ensure that you have followed the steps to create an internal integration in Notion: 1. Go to the [Notion integration settings](https://www.notion.so/my-integrations) and click on "New integration". 2. The type should be set to "Internal" by default. 3. Select the associated workspace, enter the integration name, and upload a logo if desired. 4. Click "Submit" to create the integration. 5. In the Capabilities tab, update the settings as needed and click "Show" under Secrets to copy the secret. After copying the secret, paste it into the `.env` file as shown above. This should resolve the 'Internal Server Error' <sup>[[3]](https://github.com/langgenius/dify/issues/6840)</sup>. If the issue persists, ensure that other essential environment variables are set correctly, such as `CONSOLE_API_URL`, `CONSOLE_WEB_URL`, `SERVICE_API_URL`, and `APP_API_URL`, as these are used to construct various URLs and configurations within the application <sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/jp/learn-more/faq/install-faq.md)</sup><sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/install-faq.md)</sup><sup>[[6]](https://github.com/langgenius/dify-docs/blob/main/en/getting-started/install-self-hosted/environments.md)</sup>. For further troubleshooting, you can refer to the [Self Host / Local Deployment Frequently Asked Questions (FAQs)](https://docs.dify.ai/v/zh-hans/getting-started/install-self-hosted/environments) which provides additional insights and solutions for common issues encountered during local deployment <sup>[[7]](https://github.com/langgenius/dify-docs/blob/main/en/learn-more/faq/install-faq.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@aakkino commented on GitHub (Sep 30, 2024):

I have the same issue, and I found that it was previously fixed, but the problem still occurs. October 1, 2024

@aakkino commented on GitHub (Sep 30, 2024): I have the same issue, and I found that it was previously fixed, but the problem still occurs. October 1, 2024
Author
Owner

@my-mark commented on GitHub (Oct 8, 2024):

Add the Notion data source and click Add Workspace to still display Internal Server Error. October 8, 2024

@my-mark commented on GitHub (Oct 8, 2024): Add the Notion data source and click Add Workspace to still display Internal Server Error. October 8, 2024
Author
Owner

@crazywoola commented on GitHub (Oct 9, 2024):

@aakkino @my-mark

https://github.com/langgenius/dify/blob/55e6123db93ae7fbda06596d6cd0a163747e6559/docker/.env.example#L524-L535

Did you setup these fields?

@crazywoola commented on GitHub (Oct 9, 2024): @aakkino @my-mark https://github.com/langgenius/dify/blob/55e6123db93ae7fbda06596d6cd0a163747e6559/docker/.env.example#L524-L535 Did you setup these fields?
Author
Owner

@my-mark commented on GitHub (Oct 9, 2024):

font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}




    NOTION_INTEGRATION_TYPE=internal
    
NOTION_INTERNAL_SECRET=***************Both of these fields have been set up.

    
        
    


  

    
                
        
            
                
                        
                            
                        
                        
                            malei5097
                        
                
                    
                        
                                ***@***.***
                        
                    
            
        
    
    





---- Replied Message ----



  
    
     From 
    
    
        ***@***.***>
        
    
  
  
    
     Date 
    
    
    10/9/2024 22:52
    
  
  
    
     To 
    
    
     
      
        ***@***.***>
        
      
    
  
  
    
     Cc 
    
    
      
        ***@***.***>
        ,
      
      
        ***@***.***>
        
      
    
  
  
    
     Subject 
    
    
          Re: [langgenius/dify] Self-hosted Dify cannot connect Notion "Internal Server Error" (Issue #8085)

@aakkino @my-mark
https://github.com/langgenius/dify/blob/55e6123db93ae7fbda06596d6cd0a163747e6559/docker/.env.example#L524-L535
Did you setup these fields?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

@my-mark commented on GitHub (Oct 9, 2024): font{ line-height: 1.6; } ul,ol{ padding-left: 20px; list-style-position: inside; } NOTION_INTEGRATION_TYPE=internal NOTION_INTERNAL_SECRET=***************Both of these fields have been set up. malei5097 ***@***.*** ---- Replied Message ---- From ***@***.***> Date 10/9/2024 22:52 To ***@***.***> Cc ***@***.***> , ***@***.***> Subject Re: [langgenius/dify] Self-hosted Dify cannot connect Notion "Internal Server Error" (Issue #8085) @aakkino @my-mark https://github.com/langgenius/dify/blob/55e6123db93ae7fbda06596d6cd0a163747e6559/docker/.env.example#L524-L535 Did you setup these fields? —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
Author
Owner

@sashasimkin commented on GitHub (Oct 10, 2024):

I have the same error.

In my case, this happened after I first added the some top-level page to Dify, then noticed that not all sub-pages are added, removed the top-level page and added a specific sub-page that's relevant for my bot.
After that, this Internal Server Error started happening.

I've added a small print of response_json, which shows this:

{'object': 'error', 'status': 404, 'code': 'object_not_found', 'message': 'Could not find block with ID: 73da9c9b-2396-45c2-852a-0d66fa2e6dd9. Make sure the relevant pages and databases are shared with your integration.', 'request_id': '2cb14b5b-9a18-44ba-8fa7-00cb964fea43'}

UPD: I've authorized the "top-level" page again, and after that the sync succeeded, although #9012 is still there.

@sashasimkin commented on GitHub (Oct 10, 2024): I have the same error. In my case, this happened after I first added the some top-level page to Dify, then noticed that [not all sub-pages are added](https://github.com/langgenius/dify/issues/9012), removed the top-level page and added a specific sub-page that's relevant for my bot. After that, this Internal Server Error started happening. I've added a small print of `response_json`, which shows this: ``` {'object': 'error', 'status': 404, 'code': 'object_not_found', 'message': 'Could not find block with ID: 73da9c9b-2396-45c2-852a-0d66fa2e6dd9. Make sure the relevant pages and databases are shared with your integration.', 'request_id': '2cb14b5b-9a18-44ba-8fa7-00cb964fea43'} ``` UPD: I've authorized the "top-level" page again, and after that the sync succeeded, although #9012 is still there.
Author
Owner

@ryoheiszk commented on GitHub (Oct 12, 2024):

that error still occurs, help me :(

updated v0.9.1

below my env

NOTION_INTEGRATION_TYPE=internal
NOTION_CLIENT_SECRET=
NOTION_CLIENT_ID=
NOTION_INTERNAL_SECRET=secret_xxxxxxxxxxxxxxxxxxxxxxxx

Internal Server Error

exception

api-1         | 2024-10-12 06:51:16,684.684 ERROR [Dummy-1] [app.py:838] - Exception on /console/api/oauth/data-source/notion [GET]
api-1         | Traceback (most recent call last):
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
api-1         |     rv = self.dispatch_request()
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
api-1         |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper
api-1         |     resp = resource(*args, **kwargs)
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view
api-1         |     return current_app.ensure_sync(self.dispatch_request)(**kwargs)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
api-1         |     resp = meth(*args, **kwargs)
api-1         |   File "/app/api/controllers/console/auth/data_source_oauth.py", line 45, in get
api-1         |     oauth_provider.save_internal_access_token(internal_secret)
api-1         |   File "/app/api/libs/oauth_data_source.py", line 88, in save_internal_access_token
api-1         |     pages = self.get_authorized_pages(access_token)
api-1         |   File "/app/api/libs/oauth_data_source.py", line 171, in get_authorized_pages
api-1         |     parent_id = self.notion_block_parent_page_id(access_token, parent[parent_type])
api-1         |   File "/app/api/libs/oauth_data_source.py", line 238, in notion_block_parent_page_id
api-1         |     parent = response_json["parent"]
api-1         | KeyError: 'parent'
@ryoheiszk commented on GitHub (Oct 12, 2024): that error still occurs, help me :( updated v0.9.1 below my env ```env NOTION_INTEGRATION_TYPE=internal NOTION_CLIENT_SECRET= NOTION_CLIENT_ID= NOTION_INTERNAL_SECRET=secret_xxxxxxxxxxxxxxxxxxxxxxxx ``` `Internal Server Error` exception ```bash api-1 | 2024-10-12 06:51:16,684.684 ERROR [Dummy-1] [app.py:838] - Exception on /console/api/oauth/data-source/notion [GET] api-1 | Traceback (most recent call last): api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request api-1 | rv = self.dispatch_request() api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request api-1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper api-1 | resp = resource(*args, **kwargs) api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view api-1 | return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request api-1 | resp = meth(*args, **kwargs) api-1 | File "/app/api/controllers/console/auth/data_source_oauth.py", line 45, in get api-1 | oauth_provider.save_internal_access_token(internal_secret) api-1 | File "/app/api/libs/oauth_data_source.py", line 88, in save_internal_access_token api-1 | pages = self.get_authorized_pages(access_token) api-1 | File "/app/api/libs/oauth_data_source.py", line 171, in get_authorized_pages api-1 | parent_id = self.notion_block_parent_page_id(access_token, parent[parent_type]) api-1 | File "/app/api/libs/oauth_data_source.py", line 238, in notion_block_parent_page_id api-1 | parent = response_json["parent"] api-1 | KeyError: 'parent' ```
Author
Owner

@ryoheiszk commented on GitHub (Nov 2, 2024):

same v0.10.2

"Internal Server Error"

sandbox-1     | [GIN] 2024/11/02 - 13:13:47 | 200 |        26.5µs |             ::1 | GET      "/health"
api-1         | 2024-11-02 13:13:48,908.908 ERROR [Dummy-9] [app.py:838] - Exception on /console/api/oauth/data-source/notion [GET]
api-1         | Traceback (most recent call last):
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
api-1         |     rv = self.dispatch_request()
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
api-1         |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper
api-1         |     resp = resource(*args, **kwargs)
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view
api-1         |     return current_app.ensure_sync(self.dispatch_request)(**kwargs)  # type: ignore[no-any-return]
api-1         |   File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
api-1         |     resp = meth(*args, **kwargs)
api-1         |   File "/app/api/controllers/console/auth/data_source_oauth.py", line 45, in get
api-1         |     oauth_provider.save_internal_access_token(internal_secret)
api-1         |   File "/app/api/libs/oauth_data_source.py", line 90, in save_internal_access_token
api-1         |     pages = self.get_authorized_pages(access_token)
api-1         |   File "/app/api/libs/oauth_data_source.py", line 175, in get_authorized_pages
api-1         |     parent_id = self.notion_block_parent_page_id(access_token, parent[parent_type])
api-1         |   File "/app/api/libs/oauth_data_source.py", line 242, in notion_block_parent_page_id
api-1         |     parent = response_json["parent"]
api-1         | KeyError: 'parent'
nginx-1       | 172.19.0.1 - - [02/Nov/2024:13:13:48 +0000] "GET /console/api/oauth/data-source/notion HTTP/1.1" 500 56 "https://subdomain.yourdomain.com/datasets/create" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36" "2404:7a80:1f20:8d00:2915:fd05:720f:405d"
@ryoheiszk commented on GitHub (Nov 2, 2024): same v0.10.2 "Internal Server Error" ``` sandbox-1 | [GIN] 2024/11/02 - 13:13:47 | 200 | 26.5µs | ::1 | GET "/health" api-1 | 2024-11-02 13:13:48,908.908 ERROR [Dummy-9] [app.py:838] - Exception on /console/api/oauth/data-source/notion [GET] api-1 | Traceback (most recent call last): api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request api-1 | rv = self.dispatch_request() api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request api-1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper api-1 | resp = resource(*args, **kwargs) api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view api-1 | return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] api-1 | File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request api-1 | resp = meth(*args, **kwargs) api-1 | File "/app/api/controllers/console/auth/data_source_oauth.py", line 45, in get api-1 | oauth_provider.save_internal_access_token(internal_secret) api-1 | File "/app/api/libs/oauth_data_source.py", line 90, in save_internal_access_token api-1 | pages = self.get_authorized_pages(access_token) api-1 | File "/app/api/libs/oauth_data_source.py", line 175, in get_authorized_pages api-1 | parent_id = self.notion_block_parent_page_id(access_token, parent[parent_type]) api-1 | File "/app/api/libs/oauth_data_source.py", line 242, in notion_block_parent_page_id api-1 | parent = response_json["parent"] api-1 | KeyError: 'parent' nginx-1 | 172.19.0.1 - - [02/Nov/2024:13:13:48 +0000] "GET /console/api/oauth/data-source/notion HTTP/1.1" 500 56 "https://subdomain.yourdomain.com/datasets/create" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36" "2404:7a80:1f20:8d00:2915:fd05:720f:405d" ```
Author
Owner

@TreyDong commented on GitHub (Dec 6, 2024):

you should give the intergration page's parents permission if page not is a single page.

@TreyDong commented on GitHub (Dec 6, 2024): you should give the intergration page's parents permission if page not is a single page.
Author
Owner

@Tinyzhezhe commented on GitHub (Feb 28, 2025):

自己电脑运行,编辑.env文件的变量为internal并添加秘钥,举例如下

Configure as "public" or "internal".

Since Notion's OAuth redirect URL only supports HTTPS,

if deploying locally, please use Notion's internal integration.

NOTION_INTEGRATION_TYPE=internal

Notion OAuth client secret (used for public integration type)

NOTION_CLIENT_SECRET= cz321789

@Tinyzhezhe commented on GitHub (Feb 28, 2025): 自己电脑运行,编辑.env文件的变量为internal并添加秘钥,举例如下 # Configure as "public" or "internal". # Since Notion's OAuth redirect URL only supports HTTPS, # if deploying locally, please use Notion's internal integration. NOTION_INTEGRATION_TYPE=internal # Notion OAuth client secret (used for public integration type) NOTION_CLIENT_SECRET= cz321789
Author
Owner

@kingwang22 commented on GitHub (May 14, 2025):

我有相同的问题,无法绑定notion,但是报错不一样的,dify版本是docker的1.3.1
报错信息如下:{"error":"invalid_request","error_description":"query failed validation: query.client_id should be a string or undefined, instead was 0.","request_id":"eb0d88fb-9284-4248-97ce-5e7f5e434689"}
已经配置了NOTION_INTEGRATION_TYPE=internal NOTION_CLIENT_SECRET= cz321789

@kingwang22 commented on GitHub (May 14, 2025): 我有相同的问题,无法绑定notion,但是报错不一样的,dify版本是docker的1.3.1 报错信息如下:{"error":"invalid_request","error_description":"query failed validation: query.client_id should be a string or `undefined`, instead was `0`.","request_id":"eb0d88fb-9284-4248-97ce-5e7f5e434689"} 已经配置了NOTION_INTEGRATION_TYPE=internal NOTION_CLIENT_SECRET= cz321789
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5443