serverless-plugin-optimize: Error: Cannot find module './drivers/node-mongodb-native/connection'

When using mongoose , as in just doing something like import mongoose from 'mongoose' I get this error: Error: Cannot find module './drivers/node-mongodb-native/connection'. It gets fixed if I remove the plugin so I am pretty sure this is causing it.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 19

Most upvoted comments

great @anantkas-zerone , I’m locked with this version… in the future I will try to upgrade.

That’s odd. Which version of mongoose are you using? I’m using 5.2.5 .

Have you found any solution? I’m having the same problem!

I’m getting this error with the latest version as well, I’ve downgraded to 5.2.5 and it’s not working using optimize 4.1.0-rc.1

I can exclude mongoose and add it as a layer but still getting some random error with some node module that’s completely irrelevant.