digitalnodecom / node-red-contrib-generic-s3

Generic S3 nodes for use in Node-RED
https://www.npmjs.com/package/@digitalnodecom/node-red-contrib-generic-s3
Apache License 2.0
3 stars 8 forks source link

Problem with HTTP IN Node - DataCloneError: DataCloneError: function () { [native code] } could not be cloned. #80

Open fasblom opened 1 week ago

fasblom commented 1 week ago

Hi,

When using the Put Object node in a flow involving HTTP IN and HTTP Response nodes, the presence of non-serializable objects like msg.res or msg.req causes the node to throw the error:

DataCloneError: DataCloneError: function () { [native code] } could not be cloned.

For example, a flow like [HTTP IN] -> [Function 1] -> [Put Object] -> [Function 2] -> [HTTP Response] fails to work as expected.

This makes it difficult to use the node in HTTP-based flows. It would be great if the node could handle such objects gracefully or provide guidance for working around this issue.

Thanks!

fasblom commented 1 week ago

After some further investigations the problem arrises because of the structuredClone-function used on the input message. I did a test to remove that dependency on the Put Object-function in this branch https://github.com/fasblom/node-red-contrib-generic-s3/tree/Removal-of-structuredClone-of-Put-Object and it seems to work. But there might be other good reasons why the structuredClone is there in the first place that I don't kow about.