[GH-ISSUE #1915] Metrics endpoint "Bad Request" #1187

Closed
opened 2026-03-02 11:55:38 +03:00 by kerem · 3 comments
Owner

Originally created by @Emastermind on GitHub (Sep 8, 2025).
Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/1915

Describe the Bug

After upgrading to 0.27.0, metrics endpoint doesn't work anymore. The following request throw a 400 "Bad Resquest" error:

curl --location 'https://<MY_DOMAIN>/api/metrics' \
--header 'Authorization: Bearer <MY_TOKEN>'
HTTP/2 400 
server: nginx
content-type: text/plain;charset=UTF-8
access-control-allow-origin: *
access-control-allow-methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
access-control-allow-headers: Content-Type, Authorization
access-control-allow-credentials: true
vary: RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Router-Segment-Prefetch
www-authenticate: Bearer error="invalid_request"
x-powered-by: Hono

Bad Request  

Steps to Reproduce

Use curl to request endpoint with a valid metrics token:

curl --location 'https://<MY_DOMAIN>/api/metrics' \
--header 'Authorization: Bearer <MY_TOKEN>'

See that endpoint return 400 bad request. No

Expected Behaviour

prometheus metrics results

Screenshots or Additional Context

  • Karakeep docker image version "release"
  • Behind nginx reverse proxy
  • Rollback to v0.26.0 fix the issue

Device Details

No response

Exact Karakeep Version

v0.27.0

Have you checked the troubleshooting guide?

  • I have checked the troubleshooting guide and I haven't found a solution to my problem
Originally created by @Emastermind on GitHub (Sep 8, 2025). Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/1915 ### Describe the Bug After upgrading to 0.27.0, metrics endpoint doesn't work anymore. The following request throw a 400 "Bad Resquest" error: ```bash curl --location 'https://<MY_DOMAIN>/api/metrics' \ --header 'Authorization: Bearer <MY_TOKEN>' ``` ```bash HTTP/2 400 server: nginx content-type: text/plain;charset=UTF-8 access-control-allow-origin: * access-control-allow-methods: GET, POST, PUT, PATCH, DELETE, OPTIONS access-control-allow-headers: Content-Type, Authorization access-control-allow-credentials: true vary: RSC, Next-Router-State-Tree, Next-Router-Prefetch, Next-Router-Segment-Prefetch www-authenticate: Bearer error="invalid_request" x-powered-by: Hono Bad Request ``` ### Steps to Reproduce Use curl to request endpoint with a valid metrics token: ```bash curl --location 'https://<MY_DOMAIN>/api/metrics' \ --header 'Authorization: Bearer <MY_TOKEN>' ``` See that endpoint return 400 bad request. No ### Expected Behaviour prometheus metrics results ### Screenshots or Additional Context - Karakeep docker image version "release" - Behind nginx reverse proxy - Rollback to v0.26.0 fix the issue ### Device Details _No response_ ### Exact Karakeep Version v0.27.0 ### Have you checked the troubleshooting guide? - [x] I have checked the troubleshooting guide and I haven't found a solution to my problem
kerem 2026-03-02 11:55:38 +03:00
Author
Owner

@MohamedBassem commented on GitHub (Sep 13, 2025):

Anything in the logs? Also, I assume that token that you're passing matches PROMETHEUS_AUTH_TOKEN? Can you trying changing the token to one without special chars temporarily and see if this helps?

I'm using the metrics endpoint on 0.27 and seems to be working just fine.

<!-- gh-comment-id:3288696990 --> @MohamedBassem commented on GitHub (Sep 13, 2025): Anything in the logs? Also, I assume that token that you're passing matches `PROMETHEUS_AUTH_TOKEN`? Can you trying changing the token to one without special chars temporarily and see if this helps? I'm using the metrics endpoint on 0.27 and seems to be working just fine.
Author
Owner

@Emastermind commented on GitHub (Sep 13, 2025):

Indeed ... special chars in token is the root cause. Token with specicial char like @ or # return a 400.
I swicth to alphanumeric token for now. Thanks for the support and project, I use it daily!

<!-- gh-comment-id:3288715914 --> @Emastermind commented on GitHub (Sep 13, 2025): Indeed ... special chars in token is the root cause. Token with specicial char like `@` or `#` return a 400. I swicth to alphanumeric token for now. Thanks for the support and project, I use it daily!
Author
Owner

@MohamedBassem commented on GitHub (Sep 13, 2025):

@Emastermind glad it worked!

<!-- gh-comment-id:3288775890 --> @MohamedBassem commented on GitHub (Sep 13, 2025): @Emastermind glad it worked!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/karakeep#1187
No description provided.