Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I am new to aws and just started working around with aws lambda by following some youtube tutorials and was able to write aws lambda functions successfully on the web editor itself.

But I tried with the uploading zip file from my local system in which I wrote a node.js code that uses modules "fs" and "fill-pdf". But when I tried to run the code it was giving me an error. 

"error" : module not found "/var/task/index". I searched through the internet and found some links like 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\'s saved! in same location.');




The thing is that I don't know what could be the reason that this error is coming.


1 Answer

0 votes
by (44.4k points)
selected by
Best answer

While zipping the project folder, do not zip the folder directly. Select the contents of your project folder, and zip those files. Make sure when you unzip you get the contents of the folder rather than the folder itself.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

Browse Categories