I'd like to use my easyinvoice npm package to locally store the pdf that I will create.
And two of values in my JSON data that I will post contain empty value as below (company, custom2)
{ company: '', address: 'Address 1', zip: '1010', city: 'DonorCity', country: 'DonorCountry', custom1: 1664104, custom2: '', custom3: 'Smith@gmail.com' }
Then I copy and pasted the easyinvoice npm package code from "To store the file locally (NodeJS)" block as below
const result = await easyinvoice.createInvoice(data);
await fs.writeFileSync("invoice.pdf", result.pdf, 'base64');
And now when I run this with my node.js, it gives an error saying they cannot read property 'toString' of undefined
{
error: 'TypeError',
message: "Cannot read property 'toString' of undefined",
errorId: 'db27502f6b12474eb59a28892bea555d'
}
node:internal/process/esm_loader:94
internalBinding('errors').triggerUncaughtException(
^
{
error: 'TypeError',
message: "Cannot read property 'toString' of undefined",
errorId: 'db27502f6b12474eb59a28892bea555d'
}
I am not sure how to resolve this error? Any help will be appreciated thank you heaps!