Class Transaction/TransactionHash . to_bytes() returns empty Uint8Array(0) [] - Cardano Serialisation lib

I am currently facing this issue : were transaction.to_bytes() defined over here (blockfrost-js/index.ts at master · blockfrost/blockfrost-js · GitHub)
return an empty array : Uint8Array(0)

It sometimes return correct Array when i run from one file, then if i call this from some other file (lets say i call it from a route inside a node server) it returns this empty Array.

The variable transaction is of class Transaction only (when i log it).

Could this be somehow related to some wasm memory buffer or webpack maybe?