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

401
Views
TypeError: Conversión de estructura circular a JSON - AWS Lambda

Lo sé, esta pregunta se ha hecho un montón de tiempo. Pero realmente no sé qué está mal con mi código aquí. ¿Cómo puedo solucionar este tipo de error?

¿Dónde tengo una estructura circular?

Estoy ejecutando este código en una función AWS Lambda:

 const addRanksToDB = async (tableName, stats) => { return Promise.all(Object.keys(stats).map(async (slug) => { const projectSlug = slug; const rankData = stats[slug]; const messageBody = { rowId: projectSlug, table: tableName, identifier: 'project_slug', action: 'insert', payload: { project_slug: projectSlug, ...rankData, last_updated: knexClient.fn.now(), }, }; return sqs.sendMessage({ MessageBody: JSON.stringify(messageBody), QueueUrl: 'https://sqs.eu-central-1.amazonaws.com/599632852002/handleDataInDBQueue', }).promise(); })); };

El objeto rankData se ve así:

 { one_day_volume: 191, seven_day_volume: 162, thirty_day_volume: 179, total_volume: 156, num_owners: 4, average_price: 129, market_cap: 66, floor_price: 146 }

Y este es el error que me sale:

 { "errorType": "TypeError", "errorMessage": "Converting circular structure to JSON\n --> starting at object with constructor 'Timeout'\n | property '_idlePrev' -> object with constructor 'TimersList'\n --- property '_idleNext' closes the circle", "trace": [ "TypeError: Converting circular structure to JSON", " --> starting at object with constructor 'Timeout'", " | property '_idlePrev' -> object with constructor 'TimersList'", " --- property '_idleNext' closes the circle", " at JSON.stringify (<anonymous>)", " at /var/task/src/handlers/stats/webpack:/handlers/stats/rankProjectsByStatsCronjob.js:84:27", " at Array.map (<anonymous>)", " at v (/var/task/src/handlers/stats/webpack:/handlers/stats/rankProjectsByStatsCronjob.js:67:43)", " at Runtime.R [as handler] (/var/task/src/handlers/stats/webpack:/handlers/stats/rankProjectsByStatsCronjob.js:188:23)", " at processTicksAndRejections (internal/process/task_queues.js:95:5)" ] }

El error apunta a la línea con MessageBody: JSON.stringify(messageBody), . ¿Cómo puedo estructurar mi mensaje sqs para que no reciba este error?

about 4 years ago · Santiago Gelvez
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!