{"result":null,"error":{"code":-3,"message":"Invalid amount"},"id":null}
I'm aware of the other question on this forum that says -3 is a type error that only appears when amount is negative or zero, but that is not the case as you can see above in the call body.
Thank you, this solved the problem. Here's the new code:
[{ [output]: sending.toFixed(8).toString() }],
6, // conf_target
"economical",
undefined, // fee_rate
{
"change_position": 1,
"subtract_fee_from_outputs": [0],
"inputs": [input],
},
);