Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cloudwatch lambda logs not showing nested object content

When I try to see the log of the nested object, it shows it as [object] instead of showing the actual object. Before i Console.log the object it looks fine, only show like this in the log itself.

The output looks like this:

 { url: 'https://api.11111.co.il/v1/items/11111',
     method: 'put',
     internal_data:
      { content_type: 'application/x-www-form-urlencoded',
        content_format: 'string' },
     data:
      { token:
         'XXXXXXXXXXXXXXXXXXXXXXXXX',
        item: [Object] } } }

log image

like image 433
Adi Avatar asked Nov 01 '25 05:11

Adi


1 Answers

If you are using NodeJs, you should log objects as

console.log(JSON.stringify(objectToPrint))

Other languages also have different mechanisms to convert complex JSON objects to string.

like image 170
nirvana124 Avatar answered Nov 04 '25 03:11

nirvana124



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!