Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query params are duplicated #97

Open
TimUnderhay opened this issue Apr 21, 2021 · 3 comments
Open

Query params are duplicated #97

TimUnderhay opened this issue Apr 21, 2021 · 3 comments
Labels
type/bug Unexpected behavior or a feature is broken

Comments

@TimUnderhay
Copy link
Contributor

TimUnderhay commented Apr 21, 2021

I've just discovered an interesting problem (using version 1.1.1): all query parameters specified in the query params tab arrive at my REST API wrapped in an array, with a double value (edit: not actually wrapped in an array: each query param is listed twice). For example:

image

With a simple node express app, if I dump the request query params to the console, this is what shows up:

app.get('/test', (req, res, next) => {
  console.log('query:', req.query);
  res.status(200).send('ok');
}

Yields:

  time1: [ '1618424054', '1618424054' ],
  time2: [ '1619028854', '1619028854' ]
}
@TimUnderhay
Copy link
Contributor Author

TimUnderhay commented Apr 21, 2021

This is the URL that is being called by the plugin:

/test?time1=1618424054&time2=1619028854&time1=1618424054&time2=1619028854

@TimUnderhay TimUnderhay changed the title Query params arrive wrapped in array Query params are duplicated Apr 21, 2021
@marcusolsson
Copy link
Contributor

That looks weird indeed 🤔 I'll try to troubleshoot this in the coming days. Thanks for reporting!

@marcusolsson marcusolsson added triage/needs-investigation type/bug Unexpected behavior or a feature is broken labels Apr 22, 2021
@marcusolsson marcusolsson added this to Triage in Grafana Plugins via automation Apr 22, 2021
@TimUnderhay
Copy link
Contributor Author

TimUnderhay commented Apr 22, 2021

I had a deep-ish look at this myself. I don't think the problem is in your code -- I think it's the underlying Grafana fetch function that has a bug. When the request gets handed off to getBackendSrv().fetch(req), the query params all seem to be correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Unexpected behavior or a feature is broken
Projects
Status: Backlog
Development

No branches or pull requests

3 participants