External Npm modules cannot be referenced v1.0(Bug)

  • I am trying to use moment.js inside the handler, but I get an error moment is not defined. Moreover, I followed the documentation provided here.

  • Further, on discussing in gitter, it works for some when they take the npm modules out of node_modules and put it in the same hierarchy as handler.js. In spite of doing the above change, I still get not referenced error.

Additional Data

  • Serverless Framework Version you’re using: 1.0.0-rc.1
  • Operating System: ubuntu 14.04 trusty
  • Stack Trace: referenceError: moment is not defined.
  • Provider Error messages: Runtime error
1 Like

I got the same error

Serverless Framework Version you’re using : 1.0.0-beta.2
Operating System : Windows 10 enterprise

1 Like

Can you run serverless deploy --noDeploy and inspect the created artifacts if they contain all dependencies and the handler file correctly requires the right path?

It was my mistake. I was not properly referencing the modules. It works properly.