profile
viewpoint

Ask questionsTypeError: Cannot read property 'createdAt' of undefined

Hello i´m getting this error "TypeError: Cannot read property 'createdAt' of undefined" do you have any idea what i can be?

Sequelize initialize

import {Sequelize} from 'sequelize-typescript';

const sequelize = new Sequelize(new Connection().Localhost());

/**
 * Connections to dabase
 */
export class Connection {
    
    private modelPaths = [__dirname + "/Models/Database"];

    Development(){
        return {
            name: "db_a28301_escolar",
            username: "a28301_escolar",
            password: "N@escr14",
            host:"mysql5013.smarterasp.net",
            dialect:"mysql",
            modelPaths: this.modelPaths
            
        }
    }

    Production(){
        return {
            name: "db_production",
            username: "user name",
            password: "password",
            host:"server/host",
            dialect:"mysql",
            modelPaths: this.modelPaths
        }
    }

    Localhost(){
        return {
            name: "db_restapi",
            username: "root",
            password: "root",
			host:"localhost",
			dialect: "mysql",
			modelPaths: this.modelPaths
        }
    } 
}

Model class


import {Table, Column, Model, PrimaryKey,AutoIncrement, DataType} from 'sequelize-typescript';

/**
 * reference docs: https://github.com/RobinBuschmann/sequelize-typescript
 * Model that reflect on databse table.
 */
@Table({ tableName: 'place'})
export class Place extends Model<Place> {

  @PrimaryKey
  @AutoIncrement
  @Column({ type: DataType.BIGINT})
  id: number 

  @Column({ type: DataType.STRING(45)})
  name: string

  @Column({ type: DataType.STRING(45)})
  description: string 
 
}

ERROR LOG

image

RobinBuschmann/sequelize-typescript

Answer questions nullpixel

@adamtLICOR: yeah, the error is terrible. makes these bugs really hard to track down!

useful!
source:https://uonfu.com/
answerer
nullpixel nullpixel @dynastic Developer /dev/null https://keybase.io/nullpixel 👋 this GitHub is around for archival purposes, my new one is at @jamiebishop.
Github User Rank List