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

247
Vistas
{ "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 Respuestas
Responde la pregunta

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 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