Problem with get(key) function


Just come over here finally from the main forum.

I’m trying to build out from the (web) tutorial app to add the function of being able to save and recall the address of the Mutable Data object, and I seem to have hit a bit of a wall so I was hoping someone might be able to help me out if possible.

I’ve managed to save the MD address in the app’s own container, and printed this out to the html by printing the entire contents of the MD, so I do at least know it’s there.

The problem I’m having is with the get(key) function. I seem to have got the code working so that it doesn’t throw an error, or respond that there is no entry etc. but it’s just returning some empty curly brackets each time instead of the value. The same happens with or without the experimental features turned on.

I’m very new to all this so not sure if I’m just doing something silly or whether it’s a deeper problem, but any help would be much appreciated. I’m using the newest browser with OSX High Sierra.

The functions I’m using to save and then recall the MD address are as follows:

(Note the entryKey needs manually changing each time if it is run multiple times, otherwise an error is generated as it tries to save the same key twice. Also obviously the UI components need adding to print everything to the html. If it’s easier it’s all on my github, with a slightly different version of the getSavedNameAndTag function that has the same result if I remember correctly.)

async function saveNameAndTag() {
const entryKey = ‘mutdat1namtag’
ownContainer = await safeApp.auth.getContainer(ownContainerName);
mutations = await safeApp.mutableData.newMutation();
await mutations.insert(entryKey, JSON.stringify(nameAndTag));
await ownContainer.applyEntriesMutation(mutations);

async function getOwnContainerEntries() {
const entries = await ownContainer.getEntries();
let entriesList = await entries.listEntries();
let allEntries = [];
entriesList.forEach((entry) => {
const value = entry.value;
if (value.buf.length == 0) return;
const parsedValue = JSON.parse(value.buf);
allEntries.push({ key: entry.key, value: parsedValue, version: value.version });
return allEntries;

async function getSavedNameAndTag() {
try {
const ownContainerName = await safeApp.getOwnContainerName();
const ownContainer = await safeApp.auth.getContainer(ownContainerName);
const savedNameAndTag = await ownContainer.get(‘mutdat1namtag’);
return savedNameAndTag;
} catch (err) {
throw err;


Thanks very much in advance if anyone has the time to look at this.

On GitHub you’re missing an await on this line:

Don’t know whether that’s the culprit though.



Sadly just gives the same response.

The version above was based on the example in the new API, so I’m a bit mystified.

Hey @David-B in addition to this

There is another missing await on this line

I added that and I was able to fetch the entry from the App’s container :slight_smile:



Thanks very much.

I’ll have to be more careful to await and not be too impatient next time!


Missing awaits are a frequent pain. With my own code that’s one of the first things I check now, but I have didn’t think of it when looking at yours… doh!

Good luck! :slight_smile:


I’m not a Frontend developer, but I was curious if there are any linting tools for catching this kind of thing (missing await) automatically.

I found the following article:

I think it might be helpful for you guys!