Unable to properly update (remove) data from the data storage with freshdesk sdk

I have this in my module localstore in local development :

"myapp:ticket:16_freshdesk":{"linkedTasks":["MOB-293"],"createdAt":1617552621160,"updatedAt":1617560777821}

I then want to remove one of the items of this array, like this :

client.db.update(key, 'remove', 'linkedTasks.MOB-293')

This works perfectly fine in local development, however, when using this code in production, I get this :

ExpressionAttributeNames contains invalid key: Syntax error; key: \"#MOB-293\""

Where does that “#” come from ?
Did I do something wrong here ?

EDIT : It seems it has something to do with DynamoDB since it only happens in production, however, I’m still at a loss on how I should proceed. Is there a known workaround to this problem ?

EDIT2: In the meantime, I will try retrieving the whole array, deleting what I need to, deleting the complete key, and then recreating it with the “filtered” data.

Ok, so as per the Freshdesk SDK documentation, the data storage can only remove attributes (aka JSON keys) from the stored JSON document. What you are trying to achieve is deleting one JSON array value which is not supported as of now.

The behaviour in production seems correct and there might be a bug in the FDK. What I would recommend you to do is get the document and then, only filter and set the required keys using update-set.

Hopefully this helps!

1 Like