Sequelize Error: Table is not created yet
See original GitHub issueI receive this error Error: Table is not created yet
however it creates the table called Limiters
fine.
import { RateLimiterMySQL } from "rate-limiter-flexible";
import { Handler, Request } from "express";
import { db } from "../../models";
import { config } from "../../config/";
class RateLimiterMiddleware extends RateLimiterMySQL {
constructor(ready) {
super(
{
storeClient: db.sequelize,
dbName: config.mysql.database,
points: 10,
duration: 1,
},
ready,
);
}
middleware: Handler = async (request: Request, response, next) => {
try {
await this.consume(request.ip);
next();
} catch (error) {
response.sendStatus(429); // Too Many Requests
}
};
}
export { RateLimiterMiddleware };
I can see that the table has been created
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Sequelize sync and Node.js not create table
In my case i just import Model to app.js const sequelize = require("./src/Utils/database"); const User = require(".
Read more >Model Basics
A model in Sequelize has a name. This name does not have to be the same name of the table it represents in...
Read more >Associations
To create a One-To-One relationship, the hasOne and belongsTo associations are used together; ... CREATE TABLE IF NOT EXISTS "foos" (
Read more >Model Instances
Model Instances · Creating an instance. Although a model is a class, you should not create instances by using the new operator directly....
Read more >Advanced M:N Associations
You probably noticed that the User_Profiles table does not have an id field ... The above will still create two columns userId and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah I see - thank you so much for your help!
@pete183 ok, Promise should be resolved only when table is created/checked