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

Better error message for first-time-users: No 'Access-Control-Allow-Origin' header is present #1376

Open
guettli opened this issue Dec 10, 2020 · 7 comments
Labels
discussion good first issue

Comments

@guettli
Copy link

@guettli guettli commented Dec 10, 2020

Is your feature request related to a problem? Please describe.

I try to execute my first GET request and get this result:

image

I think the first-time-user experience could get improved here.

The hint to F12 vanishes soon, and I think accessing the error message via F12 is not a nice solution.

It would be nice, if the software could tell me directly what went wrong. Then maybe some explanation, and
a way how to work around this.

@liyasthomas
Copy link
Member

@liyasthomas liyasthomas commented Dec 10, 2020

Makes sense. Toast is too small to be noticed. I appreciate if you can suggest a better way to enhance error state ux?

@liyasthomas liyasthomas added the discussion label Dec 10, 2020
@AndrewBastin
Copy link
Member

@AndrewBastin AndrewBastin commented Dec 10, 2020

Umm, we could improve the error UX. But the problem we are facing is that browsers don't let the full details of the network error to be given to the scripts. As far as the script is concerned, we are only given a "Network Error" message and it is pretty generic and is thrown for every network related issue, not only the one you mentioned as an example.

Since we can't exactly know what went wrong, we really can't suggest anything on how to fix it.

@NBTX
Copy link
Contributor

@NBTX NBTX commented Dec 11, 2020

This isn't a general solution for any CORS policy - but it would allow us to figure out perhaps if we need to show a full-page dialog prompting them to install the browser extension or enable the proxy.

We could perhaps set up an API route that works in every way except by having an Access-Control-Allow-Origin policy to a random domain. That way we could test by first requesting a 204 to some domain (to establish that the device is connected to the internet) and then make a request to our CORS route - if it succeeds, proxy or extension is enabled, if it fails, the error must be due to CORS hence we can show the full-page dialog.

@guettli
Copy link
Author

@guettli guettli commented Dec 15, 2020

@AndrewBastin this is new to me. The script just gets "NetworkError" without a message? Hmm let's focus on this. How could this be changed? Of course this is not an issue of hoppscotch any more, but on the other hand we could make life easier for thousand developers. Who could help here?

@AndrewBastin
Copy link
Member

@AndrewBastin AndrewBastin commented Dec 15, 2020

I don't think we have any other ways to get it from a browser request stand point.

The solution provided by @NBTX sounds great. But I don't really encourage it because of security concerns and the user not knowing that request is being ran on the background through a proxy.

@AndrewBastin
Copy link
Member

@AndrewBastin AndrewBastin commented May 15, 2021

@satyam-52 I don't know how this fits into the conversation here exactly.

Hoppscotch already has a built in proxy that circumvents this issue. You can enable it in the Settings page.

@satyam-52
Copy link

@satyam-52 satyam-52 commented May 15, 2021

@AndrewBastin Just re-read the problem, I just misinterpreted. Will delete my comment :)

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

No branches or pull requests

5 participants