Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

408
Vistas
sails-postgresql AdapterError: Unexpected error from database adapter: there is no parameter $1

Im pretty new to sails, im trying to create an authentication schema in my postgresql db.

I have an user model

module.exports = {
  attributes: {
    firstName: {
      type: 'string'
    },
    lastName: {
      type: 'string'
    },
    email: {
      type: 'string',
      required: true,
      unique: true
    },
    password: {
      type: 'string',
      required: true
    },
    authTokens: {
      collection: 'authToken',
      via: 'owner'
    }
  }
}

and user registration/create controller

module.exports = {

  create: function (req, res) {
    sails.log.info("Message to be logged");
    User.create(
      {
        email: req.body.email,
        firstName: req.body.firstName,
        lastName: req.body.lastName,
        password: req.body.password
      }
    ).exec(function (err) {
      if (err) {
        return res.status(400).send({err: err});
      } else {
        return res.status(200).send({message: "it is okay"});
      }
    });
  }
}

Now when im using the default localDiskDb adapter, it works, the user is created by create method. When I changed default data source in datastores.js to

default: {
    adapter: 'sails-postgresql',
    host: 'mydbserver.rds.amazonaws.com',
    user: 'myDbRoot',
    password: 'pass',
    database: 'myDbName'

  }

I can see that tables are created in my database. But when I try to call the create method it returns error:

AdapterError: Unexpected error from database adapter: there is no parameter $1

Im using these versions of sails packages:

    "sails": "^1.0.0-30",
    "sails-hook-grunt": "^1.0.4",
    "sails-hook-orm": "^2.0.0-0",
    "sails-hook-sockets": "^1.0.1",
    "sails-postgresql": "1.0.0-1",

Does anyone have an idea?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Upgrade to

"sails-hook-orm": "^2.0.0-17",
"sails-postgresql": "1.0.0-10",

solved it.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda