1

I'm using the Dynamodb resource in Retool, which is successful for GETs/Scans/Puts/Queries, but I can't seem to get an UpdateItem statement to work.

I'm trying to update an item to add a key for a list of maps if it doesn't exist and append an item if the key already does exist.

Configuration

Update Expression

SET images = list_append(:val, if_not_exists(images, :emptylist))

ExpressionAttributeValues

In Retool, my ExpressionAttributeValues are ":val": [{"location": "{{s3Uploader1.s3FolderName}}/{{s3Uploader1.s3FileName}}"}], ":emptylist":[], which pulls the s3 folder and file names from an s3Uploader and renders to ":val": [{"location": "redactedpath/redacted/redactedfilename"}], ":emptylist":[]

I originally tried the format of calling out the data types, e.g. "M", "L", etc, but I got exactly the same error.

  ":val": 
 {
   "L":
   [
     {
       "M": 
         {
           "location":
           {
         "S": "{{s3Uploader1.s3FolderName}}/{{s3Uploader1.s3FileName}}"
           } 
         }
     }
   ]
 }, 
":emptylist":
   {
     "L":[]
   } 

Result/Error

When I run the query, I get the following error:

statusCode:422
error:"Unprocessable Entity"
message:"ExpressionAttributeValues contains invalid key: Syntax error; key: "44""
data:null
estimatedResponseSizeBytes:147
resourceTimeTakenMs:363
isPreview:false
resourceType:"dynamodb"
lastReceivedFromResourceAt:1644774304601
source:"resource"

From my understanding, that error message usually specifies the actual key that caused the problem, but from what I can tell, my ExpressionAttributeValues does not contain the string 44. I'm wondering if this is something coming from Retool or if it's perhaps a location instead of the actual key.

I've dug through what feels like the depths of StackOverflow to try different things, but now I feel like I'm stuck.

Additional Information

Is there anything in the ExpressionAttributeValues that looks like it could cause that error?

Meow_ly
  • 156
  • 3
  • 11
  • Why not include the code that actually generates the syntax error? – hunterhacker Feb 13 '22 at 18:30
  • 1
    I think the ExpressionAttributeValues you are sending is **not** what you think it is. In the above example you are showing you are sending ":val" and ":emptylist" as keys in ExpressionAttributeValues, but somehow DynamodDB is getting "44" (without a colon). Try to add printouts to be sure you are really sending what you think you are sending... – Nadav Har'El Feb 14 '22 at 12:58

0 Answers0