Can't get sequelize.js to work with serverless-bundle.
See original GitHub issueI am using a lambda function to parse a file uploaded to s3 then take the data and put it in a remote mysql database. I am using sequelize.js with the mysql2 package. I’ve deployed my code but I get the this error, {“errorType”:“Error”,“errorMessage”:“Please install mysql2 package manually”}. I googled around and found that using serverless-webpack I just need to use the following.
custom:
webpack:
includeModules:
forceInclude:
- mysql
- mysql2
https://stackoverflow.com/questions/48554917/getting-sequelize-js-library-to-work-on-amazon-lambda I tried that but it obviously didn’t work with serverless-bundle. I saw a previous issue about using knex.js that looked like a similar problem. I tried installing the serverless-bundle@beta as was suggested but it didn’t install properly.
I’m brand new to serverless and I’m not sure what else to do.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
BTW, I found the work around in here. Basically Sequelize config accepts a
dialectModule
option, which would allow webpack to work around the dynamic import issue. Here’s some code fragments I extract from an working example:I suggest we create an
examples
folder, and add these solutions for special cases into there as working (but minimal) examples.For now, let me add a note to the README with your instructions. Later we can link to an example.
Edit: Added https://github.com/AnomalyInnovations/serverless-bundle/blob/master/README.md#sequelize