Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: NetworkError when attempting to fetch resource. #51

Closed
appw-cn opened this issue Mar 15, 2022 · 21 comments
Closed

TypeError: NetworkError when attempting to fetch resource. #51

appw-cn opened this issue Mar 15, 2022 · 21 comments

Comments

@appw-cn
Copy link

appw-cn commented Mar 15, 2022

Hi,

thanks for your briliant work!
I installed, but it doesn't work, and show this message:

Saving items to Notion...
Item 1 of 1
TypeError: NetworkError when attempting to fetch resource.

Do you know how can I solve it ?

Appreciated!

@dvanoni
Copy link
Owner

dvanoni commented Mar 16, 2022

Hi @appw-cn, thanks for the feedback!

I haven't seen this error before, so I'm not sure exactly what's causing it. Could you provide a couple more pieces of information for me?

  • What version of Zotero are you using?
  • Can you send a screenshot of the error logs?
    1. Open Tools > Developer > Error Console
    2. Click the Clear button at the top
    3. Try to perform the same action that caused the error
    4. Take a screenshot of any messages that appear in the console

Thanks!

@daniboy23
Copy link

Re:

I had this same error message. I performed the above: here is a screenshot of my error message from the console.

Thank you!

Zotero network error message 052422

@dvanoni
Copy link
Owner

dvanoni commented May 25, 2022

@daniboy23 thanks for the screenshot!

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 request to the Notion API.

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!

@daniboy23
Copy link

Hi @dvanoni

Thank you for your response. I have done the first half of your message and received an HTML:
image

How would I now perform the request to the Notion API in the second half of your message?

Thank you!

@daniboy23
Copy link

Re:

If this helps, I copied and pasted your second code as I did the first and received the error message:

image

Let me know what I can do to help!

@daniboy23
Copy link

I also noticed that if I insert the first code into the Java program and click run multiple times, certain elements of the return message changes

@dvanoni
Copy link
Owner

dvanoni commented May 27, 2022

@daniboy23 thanks for running those! It seems that network requests in general are working—we can see that fetching https://www.zotero.org worked just fine—but there's something going on with requests to Notion.

Could you provide some more info to help me debug?

  • What version of Zotero are you using?
  • What other plugins do you have installed in Zotero?
  • Do you have any ad blockers or similar software installed on your system that could be blocking requests to Notion?

Thanks!

@daniboy23
Copy link

@dvanoni

  • Zotero version is 6.0.8
  • Aside from Notero, my add-ons page says I have Zotero LibreOffice Integration and Zotero Word for Windows Integration:

image

  • I checked my extensions and I don't have any ad blockers software being used there. I also turned off ad blocker in my settings as well as pop up blocker and the same NetworkError message kept appearing.

Thanks for looking into this!

@dvanoni
Copy link
Owner

dvanoni commented May 28, 2022

@daniboy23 there doesn't seem to be anything out of the ordinary there. 🤔

Out of curiosity, what result do you get if you run this in the console?

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

@daniboy23
Copy link

@dvanoni This was the return message:

image

@dvanoni
Copy link
Owner

dvanoni commented May 28, 2022

Ah sorry @daniboy23, I forgot to mention: please enable the Run as async function option.

@daniboy23
Copy link

@dvanoni Oops, sorry here is the message:

image

@dvanoni
Copy link
Owner

dvanoni commented May 28, 2022

Hmm interesting. @daniboy23 what happens if you open https://api.notion.com in your browser?

@daniboy23
Copy link

@dvanoni Very interesting! That worked. Do you know why it worked now so that I can try to fix it on my own in the future?

Thank you so much for all of you help!

@dvanoni
Copy link
Owner

dvanoni commented May 28, 2022

@daniboy23 do you mean that the plugin is working correctly now and able to sync items into Notion?

@daniboy23
Copy link

@dvanoni It did work yesterday, but not today. I noticed I cannot open https://api.notion.com in my browser today like I could yesterday.

@dvanoni
Copy link
Owner

dvanoni commented May 30, 2022

@daniboy23 Huh, well that's interesting. It sounds like it might be something related to your internet provider or DNS provider.

Would you mind sending a screenshot of your browser when you try to open the URL? I'm curious to see what the specific error message is. Thanks!

@daniboy23
Copy link

@dvanoni I am getting one of these:

image

I think this could be something I could check with for IT services at my job site tomorrow. I might also try to sync on my personal computer in a couple of hours too when I'm on my home WiFi. I will let you know if I get different results. Thank you for your help!

@daniboy23
Copy link

daniboy23 commented May 31, 2022

@dvanoni It seems to be working on my home Wifi so this is apparently a work network issue which I should be able to get fixed on my end. Thank you again so much for your help! 10/10

@appw-cn
Copy link
Author

appw-cn commented Jun 8, 2022

thanks everyone.
The problem has been solved. It's my network problem, not a bug with the plug-in. It's solved when I turn down my vpn.
I think this issue could be closed. thanks again.

@dvanoni dvanoni closed this as completed Jun 9, 2022
@fantasyEthan
Copy link

I ran into this issue as well. It is the problem of VPN. Thanks for the above solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants