Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

199
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda