Skip to content

Issues with lambda not getting mysql2 dependency #2

Open
@pvautour

Description

@pvautour

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:

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
  }
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions