Error on create/insert using NFS (bug discussion arising from Dumb DOM API Questions topic)

If you create and try to insert a file using NFS in the API playground you get this error

is there a new way to upload a file via NFS with the window.safeNfsFile functions?

Also to insert an entry in a public Mutable Data Structure with Insert enabled for everyone you can’t use an unauthorised connected session, it needs to have requested permissions even if it has nothing to do with inserting an entry. Safe Chat uses '_public': ['Read'] anytime a user wants to actually post a message.

How does authoriseContainer work? I kept getting errors with it in the API playground.aconerr2

Hi @Joseph_Meagher, can you please share the snippet you are using for this? Also, are you running into this issue with mock or with the Test18?

Yes, remember that to write content in the network you need PUT credit, and that’s associated with an account, that’s why you need to connect authorised.

This is a bug which was recently fixed, so it will be solved in our next release of binaries.

1 Like

I was using the default functions in safe API Playground in this order on Testnet 18:
emulateAs NFS
insert (fails here)

1 Like

@Joseph_Meagher, you are just missing the step to commit the MD you are creating to the network before calling the emulate as NFS, i.e. make sure you call quickSetup right after you call newRandomPublic, that should do it.


It’s good that you uncovered this though. The web API playground let you go on as if nothing was wrong, even though you didn’t put the MD to the network. I’ll look into making the playground more informative and instructive.


@Joseph_Meagher In the web API playground, are you successfully able to use the file explorer to pick a file?

I previously was able to, last week, but now my window is crashing. It just turns black with the following error code in console:

It’s happening when FileReader.prototype.readAsArrayBuffer is called:

1 Like

The file explorer is working for me, but I think the filesize snippet has a small problem. The second filesize should be fileSize
return window.safeNfsFile.size(fileContextHandle)
.then(fileSize => {
return 'file size in bytes: ’ + filesize;

1 Like

Thank you for finding the typo and for confirming that the FileReader API is working on your system. I was reading about obscure FileReader issues on browsers running on particular versions of Windows 10.

Which system are you running again?

1 Like

windows 8.1, a browser/computer restart will probably clear everything up.

1 Like