marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 545 forks source link

Uncaught error: TypeError: Cannot read property 'filename' of undefined #641

Closed catamphetamine closed 3 years ago

catamphetamine commented 3 years ago
pdf.create('...', {
  phantomPath: '/tmp/phantomjs',
  script: '/var/task/pdf_a4_portrait.js',
  format: 'Letter',
  orientation: 'portrait',
  border: '1in',
  type: 'pdf'
}).toBuffer((error, buffer) => {
  // Doesn't execute this function.
  if (error) {
    return reject(error);
  }
  resolve(buffer);
});
catamphetamine commented 3 years ago

The fix is adding localUrlAccess: true option.