action #123490
closed
o3 logreports DBI Exception: DBD::Pg::st execute failed: ERROR: invalid input syntax for type bigint size:M
Added by jbaier_cz almost 2 years ago.
Updated almost 2 years ago.
Description
Observation¶
We see the following in /var/log/openqa
on o3:
[2023-01-21T22:04:08.897649Z] [error] [bXpoFGyR3PEg] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed: ERROR: invalid input syntax for type bigint: "root-console-20200501"
CONTEXT: unnamed portal parameter $1 = '...' [for Statement "SELECT me.id, me.dir_id, me.filename, me.last_seen_time, me.last_seen_module_id, me.last_matched_time, me.last_matched_module_id, me.last_updated, me.file_present, me.tags, me.t_created, me.t_updated FROM needles me WHERE ( me.id = ? )" with ParamValues: 1='root-console-20200501'] at /usr/share/openqa/script/../lib/OpenQA/WebAPI/Controller/File.pm line 65
Acceptance criteria¶
- AC1: No new error messages like this in the logs
Suggestions¶
- Add input validation to route
- Copied from action #108533: o3 logreports DBI Exception: DBD::Pg::st execute failed: ERROR: invalid input syntax for type integer added
- Status changed from New to In Progress
Looks like the problem is route patterns that are not specific enough:
$r->get('/needles/:needle_id/image')->name('needle_image_by_id')->to('file#needle_image_by_id');
$r->get('/needles/:needle_id/json')->name('needle_json_by_id')->to('file#needle_json_by_id');
$r->get('/needles/:distri/#name')->name('needle_file')->to('file#needle');
So, if someone requests GET /needles/root-console-20200501/image
or GET /needles/root-console-20200501/json
they would get this error. Making sure that the first two routes only receive numbers (/needles/<needle_id:num>/image
) should fix the issue. I'll make a PR.
- Description updated (diff)
- Status changed from In Progress to Feedback
- Subject changed from o3 logreports DBI Exception: DBD::Pg::st execute failed: ERROR: invalid input syntax for type bigint to o3 logreports DBI Exception: DBD::Pg::st execute failed: ERROR: invalid input syntax for type bigint size:M
- Description updated (diff)
- Status changed from Feedback to Resolved
Also available in: Atom
PDF