Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

206
Visualizações
How to avoid Cannot read property 'toString' of undefined in Javascript

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!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda