dvanoni / notero

A Zotero plugin for syncing items and notes into Notion

Home Page:https://download.notero.vanoni.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request to Notion API has timed out

qinting opened this issue · comments

I got a request time out error when syncing items to Notion (it happed in Notero both 0.4.713 and 0.5.7 versions). It worked alright before. When I looked into the Notero preferences, I found the Database selection box was gray out and I cannot set it up anymore.

Screenshot 2024-01-09 at 1 40 08 PM

Please let me know how to fix this issue.

Thanks,
Tingting

Hi @qinting, this sounds like it may be related to #51. In that issue, it appeared that connections to the Notion API were being blocked by the network or VPN. Are you using Notero from a new location (new network) or using a new VPN?

There are some troubleshooting steps in #51 that you can try. As a first step, are you able to open https://api.notion.com/ in your browser?

Hi @dvanoni, thanks for the quick reply. I can open/use my notion in the browser without any issue. The network and VPN are the same, and the problem exists regardless of using VPN or not. I am wondering why the Database ID box in the settings became gray out.

Hi @qinting, the database field is grayed out because of an update I made in the latest version (0.5.7). Instead of being a text field with the database ID, the field is now a dropdown that will show a list of available databases that Notero has access to. If the requests to Notion are timing out, then Notero won't be able to load the list of databases to show in this field.

Would you mind trying some commands in Zotero's JavaScript console? You can open it from Tools → Developer → Run JavaScript. Once you open it, please enable the Run as async function option.

First, I'd like to see if we can perform a basic network request. Paste the following code and click Run.

return fetch('https://www.zotero.org/').then(response => response.text());

Do you see HTML content in the right panel, or do you see an error? If you see an error, please let me know what it is. If you see HTML, let's try performing a basic request to the Notion API. Replace the code from the previous step with the following and then click Run again.

return fetch('https://api.notion.com/').then(response => response.text());

If that returns an error, please let me know what it is. If it returns data (likely HTML), please run the following code.

const databaseID = Zotero.Prefs.get('extensions.notero.notionDatabaseID', true);
const notionToken = Zotero.Prefs.get('extensions.notero.notionToken', true);
const headers = {
    'Authorization': `Bearer ${notionToken}`,
    'Notion-Version': '2022-02-22'
};

return fetch(
    `https://api.notion.com/v1/databases/${databaseID}`,
    { headers }
).then(response => response.json());

Can you let me know what the result of this is? Thanks!

@qinting, are you still encountering this issue on the latest version of Notero?