Create a pdf file from a handlebars template with variables returned from postgresql

I have a node express server.js that uses the dynamic-html-pdf middleware intended to generate a pdf report with the value returned from the postgresql database to the handlebars template that I have. I started the server, the values are showing in the browser but I received an error that I have included in this post.

const hbs = require('hbs');
const fs = require('fs');
const pdf = require('dynamic-html-pdf');

const options = {
  format: 'Letter'

app.get('/individual_report/:athlete_id', function(req, res) {'*').from('participants').where('athlete_id', req.params.athlete_id).then(data => {
    if (data.length) {
      res.render('individual_report', {
        name: data
      const html = fs.readFileSync(__dirname + '/../public/views/individual_report.hbs', 'utf8');
      const document = {
        template: hbs,
        context: {
          options: {
            name: data
        path: "./report.pdf"
      pdf.create(document, options).then(res => {
      }).catch(error => {
    } else {
        msg: 'Invalid athlete ID'
  }).catch(err => res.sendStatus(400));

{ Error: You must pass a string or Handlebars AST to Handlebars.compile. You passed [object Object]


Any idea what went wrong? Thank you.