I am new to aws and just started working with aws lambda, following some youtube tutorials, and was able to successfully write aws lambda functions in the web editor itself.
But I tried downloading the zip file from my local system, in which I wrote node.js code that uses the "fs" and "fill-pdf" modules. But when I tried to run the code, it gave me an error.
"error": module not found "/ var / task / index". I searched over the internet and found some links like: https://github.com/lob/lambda-pdftk-example I tried this, but it also shows the same error.
Here is my code:
var index = require('index'); var fillPdf = require("fill-pdf"); var fs = require('fs'); var formDate = { 'Employee Name': 'MyName', 'Company Name': 'ComapnyName' }; var pdfTemplatePath = "my.pdf"; fillPdf.generatePdf(formDate, pdfTemplatePath, function(err, output) { if ( !err ) { fs.writeFile('message.pdf', output, function (err) { if (err) throw err; console.log('It\ saved! in same location.'); }); } });
The fact is that I do not know what is the cause of this error. Thanks for any help.
learner
source share