xero-node: "createInvoiceAttachmentByFileName" Create attachment but not correct content file
SDK xero-node Version 5.1.0
Describe the bug I tested API with this code:
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);
const response = await xero.accountingApi.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body,  includeOnline,idempotencyKey, {
    headers: {
      "Content-Type": contentType,
    }
  });
But result: File uploaded but not content
About this issue
- Original URL
- State: open
- Created 4 months ago
- Comments: 17
I’m complaining about Xero. The issue is still unresolved, and it affects production too.
I would share your solution here for other people to avoid wasting time trying to upload attachments.