notero icon indicating copy to clipboard operation
notero copied to clipboard

Request to Notion API has timed out

Open qinting opened this issue 1 year ago • 3 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

qinting avatar Jan 09 '24 18:01 qinting

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?

dvanoni avatar Jan 09 '24 19:01 dvanoni

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.

qinting avatar Jan 10 '24 15:01 qinting

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!

dvanoni avatar Jan 10 '24 19:01 dvanoni

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

dvanoni avatar May 13 '24 15:05 dvanoni

Hi David,

Thanks for the follow up. It looks like the issue has been solved.

Best, Tingting

On May 13, 2024, at 11:18 AM, David Hoff-Vanoni @.***> wrote:

@qinting https://github.com/qinting, are you still encountering this issue on the latest version of Notero?

— Reply to this email directly, view it on GitHub https://github.com/dvanoni/notero/issues/423#issuecomment-2107961884, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSKHPTWCTLS7K2NDDSN2CDZCDKTTAVCNFSM6AAAAABBTSWCXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBXHE3DCOBYGQ. You are receiving this because you were mentioned.

qinting avatar May 13 '24 15:05 qinting