adnanrahic / adnanrahic/building-a-serverless-api-with-nodejs-and-aws-aurora-serverless
Issues with lambda not getting mysql2 dependency
- Lingua principale
- JavaScript
- Stelle
- 59
- Fork
- 10
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I had to modify the code to get sequelize to work properly. The issue was caused by srs deploy not properly sending the mysql2 dependency. This was fixed by modifying the db.js file. You may want to add the fix to the repo. But it may also be an issue specific to my setup. Here is the new start of the file:
``` Javascript
const Sequelize = require('sequelize')
const NoteModel = require('./models/Note')
const mysql2 = require('mysql2'); // Needed to fix sequelize issues with WebPack
const sequelize = new Sequelize(
process.env.DB_NAME,
process.env.DB_USER,
process.env.DB_PASSWORD,
{
dialect: 'mysql',
dialectModule: mysql2, // Needed to fix sequelize issues with WebPack
host: process.env.DB_HOST,
port: process.env.DB_PORT
}
)
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.