Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda