I'm trying to create a solution with FeathersJS and deploying it to AWS lambda function using serverless framework.
I used feathers generate app to create my application and choose sequelize as ORM to my application then, i tried running the app locally and then hit POST /users to register a new user and everything worked just as expected.
However, when I removed the users resource from the database then added serverless configuration and tried serverless-offline i always receive this error
{
"name": "GeneralError",
"message": "relation \"users\" does not exist",
"code": 500,
"className": "general-error",
"errors": {}
}
So, I added some console logs to trace the issue and appeared that the Sequelize configuration file run for the first time with empty model object and this is the same behaviour as the normal local run. But, the local running - without using serverless - the configuration file called two times. One time with empty models object and the second time with
{
users: users
}
Currently, I can't find the cause of missing this second time - the one responsible to create the users resource in the database.
Here is the approach that i used to handle the serverless configs
const serverless = require('serverless-http');
// This is the last line in the app.js file
module.exports.handler = serverless(app);
Hint: I also tried feathersjs/serverless but with no luck.
Thanks!