oddsdk / odd-app-template

A sveltekit web app template for the ODD SDK.
https://odd-template.fission.app
MIT License
29 stars 10 forks source link

Improve error resolving Fission server DID message #131

Open youk opened 1 year ago

youk commented 1 year ago

What is the status of this app template? Is it supposed to work? Can the app proceed beyond the "Initializing file system" screen hanging for indefinite time?

Tried registering at: http://localhost:5173/ https://odd-template.fission.app/

Result: "Initializing file system" screen

Browser console:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dns.google/resolve?name=_did.runfission.com&type=txt. (Reason: CORS request did not succeed). Status code: (null).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cloudflare-dns.com/dns-query?name=_did.runfission.com&type=txt. (Reason: CORS request did not succeed). Status code: (null).
bgins commented 1 year ago

Hi @youk 👋 . Thanks for opening the issue.

This is an issue for the ODD SDK. Would you mind opening an issue over here: https://github.com/oddsdk/ts-odd.

As a quick note, I think I've seen this error, but only at one specific coffee shop in a town nearby me. My theory is they have some router configuration that prevents these DNS lookups. It might be worth trying at another location to narrow down possible causes.

youk commented 1 year ago

Thanks for your reply, I'll go there.

As for the issue itself, the browser clearly complains about CORS violation. I don't quite understand how changing DNS configuration should help. Unless those queries are only made as fallback option.

bgins commented 1 year ago

As for the issue itself, the browser clearly complains about CORS violation.

Browsers sometimes complain about CORS issues when root cause is something else.

I don't quite understand how changing DNS configuration should help. Unless those queries are only made as fallback option.

This lookup is an essential part of the ODD SDK. We use it to look up the DID of the Fission server. It can be seen in action here: https://dnsrecords.io/_did.runfission.com.

We are making the query from JavaScript using DNS over HTTPS, instead of the browser resolving a DNS record.

This approach is newer, and that along with only experiencing this error in certain locations makes me suspicious of a router configuration. Could be something else though! I haven't investigated it enough to say.

youk commented 1 year ago

Thank you for the explanation. It was a misleading error message from the browser indeed. The current configuration of my router blocks queries to Cloudflare/Google DoH JSON APIs (and probably others).

I still have two things to ask:

  1. Couldn't the error handling in the app be improved? I mean not the indefinitely spinning "Initializing file system" screen, but a meaningful error message after DoH query fails? It seems the responsibility of an app, not the SDK.
  2. Were you thinking about making this address resolution procedure more fail-proof? I don't have hands-on programming experience with DoH, but when I try with "Use CORS Proxy" option on https://dohjs.org/, the resolution works even in my configuration. I am not saying that my router's behavior is correct (it is the effect of ad-blocking enabled), but this is OOTB feature and when enabled it will break things for other people too.
bgins commented 1 year ago

Thanks for looking into this further! ❤️

Couldn't the error handling in the app be improved? I mean not the indefinitely spinning "Initializing file system" screen, but a meaningful error message after DoH query fails? It seems the responsibility of an app, not the SDK.

Yes, indeed. We could have a better error message here. I'll re-open this issue and change the title.

Would you be interested in adding a better error message? I think I can test it out at that local coffee shop, assuming they haven't changed their router config.

Were you thinking about making this address resolution procedure more fail-proof? I don't have hands-on programming experience with DoH, but when I try with "Use CORS Proxy" option on https://dohjs.org/, the resolution works even in my configuration. I am not saying that my router's behavior is correct (it is the effect of ad-blocking enabled), but this is OOTB feature and when enabled it will break things for other people too.

It's something we can investigate. If you are still up for it, an issue in https://github.com/oddsdk/ts-odd would be appreciated. Our current focus is IPVM, so we may not get to it right away.