gavvvr / obsidian-imgur-plugin

Pastes images right to imgur.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ERROR] Imgur uploads fail constantly for a duration of time

Raagaception opened this issue · comments

Hi, first of all, AMAZING plugin. Can't express how much this has helped in reducing clutter and making it easier to share .md files directly. But recently, Imgur uploads start giving errors constantly for no apparent reason:
image
This is what the console says :
image

I had this exact same error yesterday morning, but it fixed itself when I used Obsidian again in the evening. Any idea on what might be causing this seemingly random problem?

image
... and as magically it had appeared, the issue went away after a system restart. Any idea about what might be going wrong at my end?

I had this exact same error yesterday morning, but it fixed itself when I used Obsidian again in the evening.

Hi @Raagaception , I faced the same problem once last Saturday. I was on a call and wanted to paste a screenshot to Obsidian quickly: there was the same message about error instead of a pasted image. I decided that I probably messed up with my vault or my secret somehow expired and pasted the image to other app. After the call I tried to paste it to Obsidian again and it worked!
I checked the console and I believe there was the same message about CORS 🤔

CORS request is a thing that asks a remote server (Imgur in our case) for permission from your browser (an electron-based Obsidian app in our case) to perform a POST request (to upload image in our case). And seems like sometimes Imgur can refuse (maybe under heavy load or whatever reason).

So, there is nothing on my source code side. What I can do is to catch this CORS error and modify an error message to something like:

Imgur refused image upload, please try again later

Thanks for submitting the problem

I see. Nothing can be done if it's Imgur's fault, but can you make it so that whenever upload fails, it pastes the file the normal way instead, along with the error message and the console message?

Agree, this can be improved: If the paste fails it will be better to fall back to default image handling strategy.

@Raagaception, if you face an issue again, could you please check the network tab of dev console and attach complete response information (status code, headers)?

Sure, I will. No idea why I didn't think of doing it earlier. Let this thread be open till the issue strikes again.