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

574
Visualizações
Error: invalid input syntax for type integer: "" on express server with postgres backend

Hoping some can please assist with the following express server error as unsure what to look for and why this type of error keeps on appearing. It is using a postgres db backend. It seems to also crash the server.

error: invalid input syntax for type integer: ""
    at Parser.parseErrorMessage (/home/app/server/node_modules/pg-protocol/dist/parser.js:278:15)
    at Parser.handlePacket (/home/app/server/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/home/app/server/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/home/app/server/node_modules/pg-protocol/dist/index.js:10:42)
    at Socket.emit (events.js:375:28)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at Socket.Readable.push (internal/streams/readable.js:204:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
  length: 101,
  severity: 'ERROR',
  code: '22P02',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'numutils.c',
  line: '323',
  routine: 'pg_strtoint32'
}

Is there something specific I need to look for based on this error: invalid input syntax for type integer ?

UPDATED - based on below comment, could the following insert query possibly cause this error?

const insertLogQuery = `
insert into log (log_id, run_id, s_id, q_id, message)
     values ($1, $2, $3, $4, $5)          
`;
const insertLog = await pool.query(insertLogQuery, [ id, null, null, null, reason ]);

where the columns: run_id, s_id and q_id are defined as integers.

If so, can someone pls let me know what the best approach is to prevent this error based on this code.

over 4 years ago · Santiago Trujillo
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