You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
The text was updated successfully, but these errors were encountered:
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
aBurmeseDev
added
response-requested
Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
p3
This is a minor priority issue
and removed
investigating
Issue is being investigated and/or work is in progress to resolve the issue.
labels
Apr 23, 2024
The error is related to the fact that the api returns a circular reference, so their is no way we could send the response anywhere by using http request.
The snippet is easy I shared it above, I want only to get the file from s3 and send it via http request so I can download it in my front end.
The question is, how can we get a file from s3 using nestjs and send it to a frontend by using http request knowing that the api returns a circular reference. If no is their a fix comming so the api won't return a circular reference. If no why does the api return a circular reference ?
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
The text was updated successfully, but these errors were encountered: