question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I was migrating the users service to use mysql as backend db.

const sequelize = new Sequelize('test_db', 'root', 'root', {
    host: 'localhost', dialect: 'mysql'
  })

  const User = sequelize.define('users', {
    username: {
      type: Sequelize.STRING,
      allowNull: false
    },
    email: {
      type: Sequelize.STRING,
      allowNull: false
    },
    password: {
      type: Sequelize.STRING,
      allowNull: false
    },
    roles: {
      type: Sequelize.STRING,
      allowNull: true
    },
    isVerified: {
      type: Sequelize.BOOLEAN,
      allowNull: true
    },
    verifyExpires: {
      type: Sequelize.STRING,
      allowNull: true
    },
    verifyToken: {
      type: Sequelize.STRING,
      allowNull: true
    }
  })

  const options = {
    Model: User,
    paginate: {
      default: 5,
      max: 25
    }
  }


  // Initialize our service with any options it requires
  app.use('/users', service(options));

  // Get our initialize service to that we can bind hooks
  const userService = app.service('/users');

  // Set up our before hooks
  userService.before(hooks.before(app));

  // Set up our after hooks
  userService.after(hooks.after);

It saves properly, but whenever i login a user an error occured

Uncaught TypeError: Cannot read property 'isVerified' of undefined

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ljubiccommented, Jun 29, 2017

Setting idField option to id in: .configure(authentication({idField: 'id'})) solved the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

oracle - Difference between database vs user vs schema
In Oracle, users and schemas are essentially the same thing. You can consider that a user is the account you use to connect...
Read more >
Difference between a user and a schema in Oracle?
A schema is collection of database objects, including logical structures such as tables, views, sequences, stored procedures, synonyms, indexes, ...
Read more >
The Difference between User and Schema in Oracle - Oratable
an Oracle user is a database account with login access to the database; an Oracle schema is an Oracle user plus the collection...
Read more >
Ownership and user-schema separation in SQL Server
User -schema separation allows for more flexibility in managing database object permissions. A schema is a named container for database objects, ...
Read more >
Creating users and schemas for SQL Server databases - IBM
The user must be mapped to the master database with the SqlJDBCXAUser role. Important: In Microsoft SQL server, the default schema name associated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found