influxdata / influxdata/influxdb

/telegraf/plugins GET - query parameter type with unknown value returns HTTP 500

Open
#23,897 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.

1. create a request to `/telegraf/plugins` with the query param `type` assigned a value that matches no known type
2. send the request

example

https: //twodotoh-dev-bonitoo-kk.remocal.influxdev.co/api/v2/telegraf/plugins?type=koala

__Expected behavior:__
I expected that either
* the response would be HTTP 200 with an empty set of plugins
* or, the response would be HTTP 400 with an error message that the type is invalid or not found along perhaps with an enum of available types

In general, I would expect certain common exception use cases, like a parameter with a non-matching or invalid value, to be handled gracefully.

__Actual behavior:__
The server throws HTTP 500.

__Environment info:__

Testing against K8S-IDPE remocal.

```
commit 78d0c45205ea0bc0fb9c365ff2eb4f5f2595270a (HEAD -> master, origin/master, origin/HEAD)
Author: influx-acs[bot] <107396960+influx-acs[bot]@users.noreply.github.com>
Date: Thu Nov 10 08:31:58 2022 +0000
```
__Caution - Cloud Pipeline__

I see there is a grace test `test/cloud/telegrafs.test.js:276` that asserts the HTTP 500 response. If this issue should be fixed, so that this case is handled as described above, this test will also need to be updated.

Contributor guide

Open the contributing guide

Research direction

Start with the GET /telegraf/plugins behavior described in the reproduction and the existing assertion at test/cloud/telegrafs.test.js:276. Determine the intended response for an unknown type, then update the implementation and test so the request no longer produces an HTTP 500 and the test reflects the agreed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust
Domain
api, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.