Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
{ "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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!