5

I need another set of eyes on this. For the life of me I see no issues with this parameter set, used for Dynamo DocumentClient, update method - (here: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#update-property ).

{
    TableName: "mygame-dev",
    Key: { pk: "09d017aa-cbf7-42ce-be6a-a94ecb58f9a7", sk: "GAME" },
    ExpressionAttributeNames: { "#GAMELASTUPDATED": "gameLastUpdated", "#GAMETITLE": "gameTitle" },
    ExpressionAttributeValues: { ":gamelastupdated": 1556376010704, ":gametitle": "test title 1" },
    UpdateExpression: "SET #GAMELASTUPDATED = :gamelastupdated, #GAMETITLE = :gametitle",
    ReturnValues: "ALL_NEW"
};

Error:

ValidationException: ExpressionAttributeNames can only be specified when using expressions

Any thoughts?

ElasticThoughts
  • 3,417
  • 8
  • 43
  • 58

1 Answers1

6

Disregard, this was a copy and paste issue... I was using "query" not "update"

Was:

const updateGameResult = await ddbCall("query", params);

Should have been:

const updateGameResult = await ddbCall("update", params);
ElasticThoughts
  • 3,417
  • 8
  • 43
  • 58
  • Not really, according to the docs this expression can be used in query as well: https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-dynamodb-2012-08-10.html#query – showtime May 23 '22 at 14:53