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

109
Views
Reaccionar a Lambda a DynamoDB (problema de propiedad "clave")

Tengo este código para enviar la solicitud desde la aplicación React usando Axios a Lambda:

 export const addTodo = createAsyncThunk( 'todoApp/todos/addTodo', async (todo, { dispatch, getState }) => { const response = await axios.post('https://api.us-west-2.amazonaws.com/prod/', { Key: { key1: `${todo.id}`, key2: `${todo.title}`, key3: `${todo.notes}`, key4: `${todo.startDate}`, key5: `${todo.dueDate}`, key6: `${todo.completed}`, key7: `${todo.starred}`, key8: `${todo.important}`, key9: `${todo.deleted}`, key10: `${todo.labels}` } }); const data = await response.data; dispatch(getTodos()); return data; } );

Y aquí está la función Lambda:

 const AWS = require('aws-sdk'); const docClient = new AWS.DynamoDB.DocumentClient({region: "us-west-2"}); exports.handler = (event, context, callback) => { console.log("Processing..."); const params = { Item: { "id": event.key1, "title": event.key2, "notes": event.key3, "startDate": event.key4, "dueDate": event.key5, "completed": event.key6, "starred": event.key7, "important": event.key8, "deleted": event.key9, "labels": event.key10 }, TableName: "Todo" }; const response = { statusCode: 200, headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': true, }, body: JSON.stringify('Done'), }; docClient.put(params, function(err, data) { if(err){ callback(err, null); } else { callback(null, data); } }) };

El mismo código funciona exactamente en mi otra aplicación para Contactos, pero no aquí, que es una aplicación Todo. Siempre me sale el error de:

 Warning: Each child in a list should have a unique "key" prop.

El problema es que la función Lambda no obtiene los elementos clave que configuré. ¿Hay algo que me perdí?

about 4 years ago · Juan Pablo Isaza
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!