Skip to content

"errorMessage": "Error: Cannot find module '/var/task/package.json'", #376

@iDcodes

Description

@iDcodes

In my serverless.yml

bundle:
    caching: true
    esbuild: true
    linting: false
    minifyOptions:
      keepNames: true 
      minify: false
    externals:
      - backbone
      - batch
      - errlop 

package.json

"dependencies": {
    "@turf/turf": "^3.7.0",
    "bluebird": "^3.4.6",
    "bunyan": "^1.8.1",
    "bunyan-prettystream": "^0.1.3",
    "cheerio": "^1.0.0",
    "docpad": "~6.79.0",
    "docpad-plugin-copy": "~2.1.3",
    "docpad-plugin-handlebars": "~2.3.0",
    "docpad-plugin-ignoreincludes": "~2.1.0",
    "docpad-plugin-less2": "~2.0.4",
    "docpad-plugin-sitemap": "~2.2.0",
    "dotenv": "^16.4.5",
    "emailjs": "^1.0.12",
    "glob": "^10.4.1",
    "got": "^13.0.0",
    "graceful-fs": "^4.1.9",
    "gulp": "^5.0.0",
    "gulp-concat": "^2.6.0",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-uglify-es": "^3.0.0",
    "js-yaml": "^3.7.0",
    "lodash": "^4.16.2",
    "lunr": "^0.7.2",
    "mime-types": "^2.1.12",
    "mkdirp": "^0.5.1",
    "ncp": "^2.0.0",
    "responsive-toolkit": "^2.6.3",
    "rimraf": "^5.0.7",
    "serverless-plugin-write-env-vars": "^1.0.1",
    "stringbuilder": "0.0.11",
    "webpack-stream": "^3.2.0"
  },
"devDependencies": {
    "@aws-sdk/client-s3": "^3.577.0",
    "@aws-sdk/lib-storage": "^3.578.0",
    "serverless-bundle": "^6.3.0"
  }

My application folder structure:

my-app

  • bower_components
  • lib
  • node_modules
  • out
  • src
    -- layout
    -- render
    -- static
  • builder.js
  • handler.js

Where in the handler.js the code inside it is to call the function in builder.js and this builder it will generate the static site using docpad along with other logics needed inside. Now, after I use this serverless-bundle and tried to serverless deploy to generate my lambda package and try to invoke the deployed lambda I encountered this error. I already search online for the possible solution but unfortunately there's nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions