First time with Webnative SDK

I made a sample app to see what it’s like to integrate with Fission.

https://fission-proof.5apps.com/

In sharing my observations here, I don’t mean to be overly critical: this is just the delta between what is normal for me with remoteStorage and the ‘extra’ that webnative requires. I tested on the latest Chrome and Firefox via macOS.

  • Using the app offline appears to have some quirks.
    • If I turn off Wi-Fi, sometimes data doesn’t store locally even after waiting a few seconds before reloading.
    • On some occasions it seems like no data loads (waiting for wn.initialise I think) until the internet comes back.
    • I replicate these issues [inconsistently] by creating a bunch of documents quickly, waiting, and then reloading.
  • Seems like there are no change events for files yet?
  • The 2MB payload is relatively heavy compared to the size of the app (~800kb?). Would be nice if it were lighter so it can be imported via Rollup to create a single javascript bundle.
  • I need to keep track of ‘did push the fission button’ in multiple places within the app (on startup, on create, on update, on delete). Would be better for fs to wrap local storage APIs and handle the transition from anonymous to account via the library.
  • I am forced to use localhost because of ‘insecure-context’ errors. I almost never use localhost and have custom local domains for each project.
  • Probably related to the last point. Opening the app on localhost in Firefox Private Mode breaks with the error Uncaught (in promise) UNSUPPORTED_BROWSER. Opening the app on localhost in Chrome Private Mode breaks with the error Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('https://auth.fission.codes/') with script ('https://auth.fission.codes/service-worker.js'): The user denied permission to use Service Worker.. I understand that some cryptography features are unavailable in certain contexts but it would be nice for the app to function (or at least fake it) because private tabs are an important clean slate for testing.
  • Safari 12 is unfortunately my main browser and I am not able to use it for this… I can authenticate now but when I return to the app it breaks with the error Unhandled Promise Rejection: Error: No available storage method found..
  • remoteStorage is more ‘JSON-dominant’ than a replication of the filesystem. A path is more like a string and I don’t need to create directories before writing: storing an object is essentially a single API call. It creates and deletes ‘directories’ automatically as the files within them are written or cleared. There are separate read/write APIs for objects vs files (even though the ultimate destination is like a ‘file’) to make it easier to deal with JSON.

My code is kind of messy but it’s on GitHub GitHub - rosano/fission-proof

4 Likes

@rosano thanks for the feedback! Always awesome to get detailed notes like this.

Yep, it sucks that Apple’s browser is tied to operating system.

We rely on some modern browser APIs that are available in browsers since 2018 or so.

I just looked up Safari versions. If you are on MacOS Mojave or higher, you should be able to upgrade to Safari 14?

I have to put a note in the guide for this.

Possibly true but I’m avoiding any upgrades to be able to load web extensions without Xcode… I choose to suffer the consequences.

I also had this error. It turned out to be related to privacy settings for cookies in incognito mode. When third-party cookies are blocked in incognito mode, the service worker permissions are denied (even though cookies aren’t being used here). Setting the privacy settings to allow cookies like this

cookies

will allow the service worker permission and it should all work from there.

2 Likes

I think this is the feature you are asking about?

(There is a global workaround mentioned there.)

Yup! I’ll check out the workaround, thank you.