adnanrahic / adnanrahic/building-a-serverless-api-with-nodejs-and-aws-aurora-serverless
Issues with lambda not getting mysql2 dependency
- Lenguaje dominante
- JavaScript
- Estrellas
- 59
- Forks
- 10
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
}
)
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.