I’m getting a 400 Bad Request Error parsing body when using the REST API with Node.js to create a card attachment. I’m successful at creating the card attachments in Postman, so I know my parameters and settings are correct.
I was wondering if someone could review the code below and offer advice on how to troubleshoot my issue?
I’m not too familiar with Node, but are you sure createReadStream is returning or closing the stream in the way you’re expecting? I’ve known postman to give handouts in this area in some cases where they take do more than what you expect them to.
I refactored my code and changed out the createReadStream method with the readFileSync method and after doing this got the attachment to create on the card - yay! Node isn’t my strong suit and I’m still learning. I think I had other issues in the code above as well, so I decided to take a more careful approach and console.log() each step of the way to make sure what I was passing into fetch was certain.