Skip to content

Setting after parameter for /carves endpoint returns error #14571

@getvictor

Description

@getvictor

Fleet version: Fleet 4.38.1

Web browser and operating system: macOS


💥  Actual behavior

Specifying an after parameter for /carves endpoint causes an error.

This parameter is not documented, so this is not an urgent issue. But we should fix the error and document the parameter.

🧑‍💻  Steps to reproduce

curl -k -i -H "Authorization: Bearer $TEST_TOKEN" "https://localhost:8080/api/v1/fleet/carves?order_key=carve_size&after=809472"
HTTP/2 422
content-type: application/json; charset=utf-8
content-length: 317
date: Mon, 16 Oct 2023 14:58:14 GMT

{
  "message": "Validation Failed",
  "errors": [
    {
      "name": "base",
      "reason": "Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? ORDER BY `carve_size` ASC LIMIT 1000000' at line 16"
    }
  ]
}

🕯️ More info (optional)

It appears that the after value is not being set in the SQL statement. Here's the relevant log from server:
level=error ts=2023-10-16T15:04:13.717676Z component=sql-interceptor duration=716.875µs query="SELECT id, host_id, created_at, name, block_count, block_size, carve_size, carve_id, request_id, session_id, expired, max_block, error FROM carve_metadata WHERE NOT expired AND carve_size> ? ORDER BYcarve_sizeASC LIMIT 1000000" args={} err="Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? ORDER BYcarve_size ASC LIMIT 1000000' at line 16"

Metadata

Metadata

Assignees

Labels

#g-endpoint-opsEndpoint ops product group:releaseReady to write code. Scheduled in a release. See "Making changes" in handbook.bugSomething isn't working as documented~released bugThis bug was found in a stable release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions