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

250
Visualizações
{ "message": "invalid input syntax for type integer: \"12 Pro\"" } Below error appears while trying to send POST request with PostgreSQL

Error appears while trying to send POST request with PostgreSQL/Sequelize what could be the problem here?

  async create(req, res, next) {
    try {
      let { name, price, brandId, typeId, info } = req.body;
      const { img } = req.files;
      let fileName = uuid.v4() + ".jpg";
      img.mv(path.resolve(__dirname, "..", "static", fileName));
      const device = await Device.create({
        name,
        price,
        brandId,
        typeId,
        img: fileName,
      });

      return res.json(device);
    } catch (e) {
      next(ApiError.badRequest(e.message));
    }
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The error checks are failing: You are providing a string where an Integer is expected. What causes it is uncertain unless you provide the interface for Device.create(). Check the docs and make sure your input data has the correct types.

EDIT: The following thoughts were bogus There might also be a mix-up with your input: When using the shorthand object notation as you did, make sure your arguments have the right order. Depending on framework your input might just be wrong syntax, because you are essentially initializing an object with no keys but img. If your framework doesn't correct that, this might also be the error source.

But again, without further information on what the function call expects and what type your arguments have, debugging is fortune telling.

about 4 years ago · Juan Pablo Isaza 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