S3.getObject "Converting circular structure to JSON" error in node 8.10
See original GitHub issueconst AWS = require('aws-sdk');
const s3 = new AWS.S3();
exports.handler = async (event) => {
// TODO implement
var params = {
Bucket: 'bucketName',
Key: `Key`
};
return s3.getObject(params, function(err, data) {
if (err) { // an error occurred
console.log(err)
return 'Hello from Lambda!, error';
} else { // successful response
console.log(data);
return 'Hello from Lambda! data';
}
});
};
{
"errorMessage": "Converting circular structure to JSON",
"errorType": "TypeError",
"stackTrace": []
}
START RequestId: f66642cd-6561-11e8-9101-45144114db6b Version: $LATEST
Unable to stringify response body as json: Converting circular structure to JSON: TypeError
at JSON.stringify (<anonymous>)
2018-06-01T06:06:46.750Z f66642cd-6561-11e8-9101-45144114db6b { AcceptRanges: 'bytes',
LastModified: 2018-05-13T08:32:08.000Z,
ContentLength: 198,
ETag: '"6c437a16c722e7f90b76dc3198355248"',
ContentType: 'application/json',
Metadata: {},
Body: <Buffer 7b 0a 20 20 20 20 22 6d 61 6b 65 22 3a 20 22 46 69 61 74 22 2c 0a 20 20 20 20 22 6d 6f 64 65 6c 22 3a 20 22 35 30 30 22 2c 0a 20 20 20 20 22 72 72 70 ... > }
END RequestId: f66642cd-6561-11e8-9101-45144114db6b
REPORT RequestId: f66642cd-6561-11e8-9101-45144114db6b Duration: 936.36 ms Billed Duration: 1000 ms Memory Size: 128 MB Max Memory Used: 32 MB
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top Results From Across the Web
"Converting circular structure to JSON" while reading data ...
I getting data from RDS correctly but facing problems while inserting it into DynamoDB. I am sharing my code and error message please...
Read more >Converting circular structure to JSON in nodejs-node.js
TypeError : Converting circular structure to JSON in nodejs: This error can be seen on Arangodb when using it with Node.js, because storage...
Read more >@aws-cdk/aws-s3 | Yarn - Package Manager
Define an unencrypted S3 bucket. const bucket = new s3.Bucket(this, 'MyFirstBucket');. Bucket constructs expose the following deploy-time attributes:.
Read more >AWS S3 GetObject API Walkthrough with NodeJS - YouTube
Learn all about the S3 GetObject API and how to use it with NodeJS.Become a Better Developer Using the Courses I Recommend Below:-...
Read more >Red Hat Integration 2020-Q2 Data Virtualization Reference
official Joyent Node.js open source or commercial project. ... and JSON responses are converted to tabular results.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had to promisify the .getObject to make it work with async
@taylor-zr
The ‘response’ you’re attempting to return is the actual request, which has a circular reference to itself, resulting in the error you’re seeing.
Could you try this instead?