Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

407
Visualizações
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 Respostas
Responde à pergunta

0

Upgrade to

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

solved it.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda