Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

106
Vistas
Javascript Trasnact Write failing on increment item

I am trying to do a transact write in DynamoDB. I can't seem to see the error and the error says "validationError, none" which isn't particualarly helpful. The Put for sure works but I am keeping here for completeness in the example

    await dynamoDb.transactWrite({
      TransactItems: [
        {
          Put: {
            TableName: process.env.TABLE_NAME,
            Item: {
              pk: compoundId,
              sk: interest,
              gsi1pk: "#INTEREST",
              interest: interest,
              id,
            },
          },
        },
        {
          Update: {
            ExpressionAttributeValues: {
              ":num": 1,
              ":initial": 0,
            },
            ExpressionAttributeNames: {
              "#tally": "tally",
            },
            Key: {
              PK: shop,
              SK: interest,
            },
            TableName: process.env.TABLE_NAME,
            UpdateExpression:
              "SET #tally = if_not_exists(tally, :initial) + :num",
          },
        },
      ],
    });

I'm fairly confident that this is doable per these similar solved questions here:

ItemCollectionMetrics is empty after successful transactWrite using DynamoDB.DocumentClient

Increment the value if it exists, else add a new entry in DynamoDB

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The following appears to have worked and the error was adding the ExpressionAttributeNames

    await dynamoDb.transactWrite({
      TransactItems: [
        {
          Put: {
            TableName: process.env.TABLE_NAME,
            Item: {
              pk: compoundId,
              sk: interest,
              gsi1pk: "#INTEREST",
              watching: watching,
              interest: interest,
              id,
            },
          },
        },
        {
          Update: {
            ExpressionAttributeValues: {
              ":num": 1,
              ":initial": 0,
            },
            Key: {
              pk: shop,
              sk: interest,
            },
            TableName: process.env.TABLE_NAME,
            UpdateExpression:
              "SET tally = if_not_exists(tally, :initial) + :num",
          },
        },
      ],
    });
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda