Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
how to do the update when my key is called key

I have a problem with an update in dynamoDB , when performing the update in dyanamo it tells me that I cannot use the key keyword

"message": "Value provided in ExpressionAttributeNames unused in expressions: keys: {#keyid}", "code": "ValidationException", "time": "2022-05-06T00:24:03.502Z",

When using the ExpressionAttributeNames I must relate the key with a different name "Key" but in the table its id is called key and it generates the previous error when updating this my code.

function updateUser(key, sortkey, dateFiling) {

    try {

        let params = {
            TableName: env.getEnv(CTE.User),
            Key: { "#keyid": key , "sortkey": sortkey },
            UpdateExpression: "set dateFiling = :dateFiling",
            ExpressionAttributeNames: { '#keyid': 'key' },
            ExpressionAttributeValues: { ":dateFiling": dateFiling }
        };

        await db.updateItem(params);

        console.log(params); 
    }

    catch (error) { 

        console.log('Error  in updateUser %j:', error);
   }
}

my doubt is exactly with the ExpressionAttributeNames since it does not take the keyid envelope to refer to the key and not have a problem with the use of the reserved word. Can somebody help me. please

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The Key argument accepts reserved keywords:

Key: { "key": key , "sortkey": sortkey },

Reserved keywords are no-nos in expressions like UpdateExpression. DynamoDB is complaining that you are not using ExpressionAttributeNames in a expression, which is true. Remove it.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!