arabold/serverless-sentry-plugin

Error: Cannot find module 'raven'

adambiggs opened this issue · 3 comments

After following the setup instructions and deploying a function, all requests return the following error:

{
  "errorMessage": "Cannot find module 'raven'",
  "errorType": "Error",
  "stackTrace": [
    "Function.Module._load (module.js:276:25)",
    "Module.require (module.js:353:17)",
    "require (internal/module.js:12:17)",
    "Object.<anonymous> (/var/task/properties/_serverless_handler.js:1550:19)",
    "Module._compile (module.js:409:26)",
    "Object.Module._extensions..js (module.js:416:10)",
    "Module.load (module.js:343:32)",
    "Function.Module._load (module.js:300:12)",
    "Module.require (module.js:353:17)"
  ]
}

Maybe this is caused by using severless-runtime-babel?

I've never used serverless-runtime-babel myself, but that's possible. Did you check the babelify/browserify options? Most importantly the raven module needs to be added the package.json your code uses, not necessarily to the package.json of used by serverless. Assuming you have a subfolder /src in which you have all your source files as well as all the dependencies, raven needs to be added to /src/package.json so it's available from your source.

I'm still thinking of a way how I can automate this, so raven gets installed automatically. But I didn't come up with a good solution yet.

I've updated the README.md to explain the Error: Cannot find module 'raven' and how to fix it.