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

617
Vistas
Uno o más valores de parámetros no son válidos: dynamodb
const dynamoDBConfig = require("../../config/dynamodb"); var AWS = require("aws-sdk"); AWS.config.update(dynamoDBConfig.aws_remote_config); var dynamodb = new AWS.DynamoDB(); var params = { TableName : "year", KeySchema: [ { AttributeName: "year", KeyType: "HASH"}, //Partition key { AttributeName: "title", KeyType: "RANGE" } //Sort key ], // other properties, it is the same every time }; dynamodb.createTable(params, function(err, data) { if (err) { console.error("Unable to create table. Error JSON:", JSON.stringify(err, null, 2)); } else { console.log("Created table. Table description JSON:", JSON.stringify(data, null, 2)); } });

Puede notar que mi clave principal es year , AttributeName: "year", KeyType: "HASH" . Si solo cambio el nombre de la tabla, también funciona bien. Pero, cuando cambio, AttributeName: "year", KeyType: "HASH" a AttributeName: "anything", KeyType: "HASH" , entonces está generando un error.

 Unable to create table. Error JSON: { "message": "One or more parameter values were invalid: Some index key attributes are not defined in AttributeDefinitions. Keys: [test, title], AttributeDefinitions: [title, year]", "code": "ValidationException", "time": "2021-01-28T05:33:33.723Z", "requestId": "H4S1BQ5LB4G46S594UTBK4QMVRVVASDASSFGFGF4KQNSO5AEMVJF66Q9ASUAAJG", "statusCode": 400, "retryable": false, "retryDelay": 4.143072370771728 }

¿Qué pasa cuando cambio el nombre del atributo de la clave principal?

Parámetros completos

 var params = { TableName : "iam", KeySchema: [ { AttributeName: "test", KeyType: "HASH"}, //Partition key { AttributeName: "title", KeyType: "RANGE" } //Sort key ], AttributeDefinitions: [ { AttributeName: "year", AttributeType: "N" }, { AttributeName: "title", AttributeType: "S" } ], ProvisionedThroughput: { ReadCapacityUnits: 10, WriteCapacityUnits: 10 } };
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

El problema se debe al hecho de que su KeySchema no coincide con AttributeDefinitions .

En KeySchema tiene test , mientras que en sus AttributeDefinitions tiene year . Obviamente, esto conduce a su problema, ya que no puede tener AttributeDefinitions que no sean parte de su KeySchema , ni parte del esquema de índices secundarios locales o globales.

over 4 years ago · Santiago Trujillo 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