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

Cant save value REST API query - invalid query name autogenerated with query parameters #15368

Open
rjmercier1 opened this issue Jan 14, 2025 · 5 comments
Labels
bb-data-ui bb-rest bug Something isn't working

Comments

@rjmercier1
Copy link

Checklist

  • [X ] I have searched budibase discussions and github issues to check if my issue already exists

Hosting

  • Self
    • Method: docker
    • Budibase Version: 3.2.37

Describe the bug
A specific rest api parameter makes the query unable to save

To Reproduce
Steps to reproduce the behavior:
Create a rest api with this parameter:
query sum(rate(rfx_instance_net_rd{domain="srs"}[6m]))

Expected behavior
It should save the query

Additional context
docker log at time of error:

{"level":"WARN","timestamp":"2025-01-14T23:01:39.915Z","service":"@budibase/server","err":{"type":"BadRequestError","message":"Invalid query name","stack":"BadRequestError: Invalid query name\n at Object.throw (/app/node_modules/koa/lib/context.js:97:11)\n at save16 (/app/dist/index.js:186293:14)\n at save16 (/app/node_modules/dd-trace/packages/datadog-instrumentations/src/koa.js:88:57)\n at save16 (/app/node_modules/dd-trace/packages/datadog-shimmer/src/shimmer.js:31:21)\n at save16 (/app/node_modules/dd-trace/packages/datadog-shimmer/src/shimmer.js:31:21)\n at dispatch (/app/node_modules/koa-compose/index.js:42:32)\n at /app/dist/index.js:134133:12\n at /app/node_modules/dd-trace/packages/datadog-instrumentations/src/koa.js:88:57\n at /app/node_modules/dd-trace/packages/datadog-shimmer/src/shimmer.js:31:21\n at /app/node_modules/dd-trace/packages/datadog-shimmer/src/shimmer.js:31:21\n at dispatch (/app/node_modules/koa-compose/index.js:42:32)\n at /app/dist/index.js:129554:14\n at /app/dist/index.js:179181:14\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async middleware3 (/app/dist/index.js:166083:20)\n at async /app/node_modules/koa-compress/lib/index.js:38:5\n at async errorHandling (/app/dist/index.js:133918:5)\n at async /app/node_modules/koa-mount/index.js:52:26\n at async userAgent (/app/node_modules/koa-useragent/dist/index.js:12:5)\n at async contentSecurityPolicy (/app/dist/index.js:133997:5)\n at async ip_default (/app/dist/index.js:134158:16)","status":400,"statusCode":400,"expose":true},"pid":29,"tenantId":"default","correlationId":"f1f6b420-af9f-4b87-ae2f-0853d8d2993f","msg":""}
{"level":"INFO","timestamp":"2025-01-14T23:01:39.915Z","service":"@budibase/server","req":{"method":"POST","url":"/api/queries","correlationId":"f1f6b420-af9f-4b87-ae2f-0853d8d2993f"},"res":{"status":400},"responseTime":40,"msg":"request completed"}

@rjmercier1 rjmercier1 added the bug Something isn't working label Jan 14, 2025
Copy link

linear bot commented Jan 14, 2025

@rjmercier1
Copy link
Author

This is a query against a Prometheus host.. The query language is PromQL

Copy link
Contributor

andz-bb commented Jan 21, 2025

hey @rjmercier1 - are you using the GET or POST method for this query? https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries

if you're using the GET it might work better to switch to a POST and include your PromQL in the request body

@rjmercier1
Copy link
Author

rjmercier1 commented Jan 21, 2025 via email

@andz-bb andz-bb changed the title Cant save value REST API query Cant save value REST API query - invalid query name autogenerated with query parameters Jan 28, 2025
Copy link
Contributor

andz-bb commented Jan 28, 2025

hey @rjmercier1 - Budibase automatically names the query based on the REST URL. There's some character in your query parameter value that is invalid for the Query name. I'll keep this issue up to fix the validation problem. In the meantime you can rename the query using the pencil icon to something that can be saved.

image.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bb-data-ui bb-rest bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants