Open vander99 opened 5 months ago
Hi @vander99 - thanks for reaching out.
i think the error you're seeing is more of NestJS related rather than SDK. From my quick research, this error is occurs when you try to convert an object into JSON but the object contains a circular reference. Here are my search results.
If you need further assistance, please share a larger code snippet of your file to give me more insight.
Hope it helps, John
Hi, Any solution on this. I have been fighting this issue for a full day now.
Checkboxes for prior research
Describe the bug
Hello, I am trying to download a file from nestjs, send it to angular server using a REST POST endpoint in order to trigger the download of this file.
But I get this error: ERROR [ExceptionsHandler] Converting circular structure to JSON --> starting at object with constructor 'TLSSocket' | property 'parser' -> object with constructor 'HTTPParser' --- property 'socket' closes the circle Do you have a solution to this probleme ?
Her is my controller: @Post('download') async downloadFile(@Body() body:bodyObject) { return await this.s3Client.send( new GetObjectCommand({ Bucket: 'bucket-name', Key: file-name, })); }
My nodejs version: v20.10.0 nestjs version: @nestjs/core@8.4.7 aws-sdk/client-s3 version: 3.554.0
SDK version number
@aws-sdk/client-s3@3.556.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.10.0
Reproduction Steps
Download a file from s3 using GetObjectCommand then send it by rest endpoint to a frontend server
@Post('download') async downloadFile(@Body() body:bodyObject) { return await this.s3Client.send( new GetObjectCommand({ Bucket: 'bucket-name', Key: file-name, })); }
Observed Behavior
Error:
ERROR [ExceptionsHandler] Converting circular structure to JSON --> starting at object with constructor 'TLSSocket' | property 'parser' -> object with constructor 'HTTPParser' --- property 'socket' closes the circle
Expected Behavior
The file to be send, so we can trigger then download in the frontend
Possible Solution
No response
Additional Information/Context
No response