I'm trying to use pdfkit v.0.12.1 with AWS CDK and a Lambda function (tried both typescript and js). When I try to run it I get this error:
Error: ENOENT: no such file or directory, open '/var/task/data.trie The Lambda looks like this:
const PDFKIT = require("pdfkit")
const pdfPromise = new Promise(resolve => {
const doc = new PDFKIT()
doc.text('hello pdf Kit...Please work', 100, 50)
doc.end()
const buffers = []
doc.on("data", buffers.push.bind(buffers))
doc.on("end", () => {
const pdfData = Buffer.concat(buffers)
resolve(pdfData)
})
})
Lambda runtime is Nodejs_12_x All the code is importd into the Lambda, but I'm unsure if I have everything to run. Lambda file size is about 650kb. Any help appreciated on how to get around this.