-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Counterintuitive Accept
-Header for the json-query
monitor
#4491
Comments
Before we dive into a deeper reproduction, let's cover the easy cases first: Have you tried looking at the URL you are trying to monitor in a different window? |
I tried reproducing this issue and cannot. => please verify that all parameters are exactly equal (auth method, headers, URL, required response-type, request body-encoding, …). I am assuming you are getting an http/xml message. Steps I did to reproduce this:
|
You can see from my screenshot earlier that the response is JSON. Is there anything you'd like for me to do to demonstrate? |
Our Uptime-Kuma instance is running behind Istio. Are there any known issues running in that configuration? This is the only monitor type we've had any issues with. |
Unlikely. Reverse proxies only affect incoming traffic, not outgoing, or is Istio different? |
Please also try executing the above curl command in the container itsself (see Maybe this has different results from your local machine |
Kind of, the gateway acts as a reverse proxy, but the istio sidecar is technically a transparent full proxy. I've never had issues with Istio mangling requests in or out, but I figured it was worth asking. My results with curl (below) pretty definitively prove that the issue isn't Istio though.
Curl from the uptime-kuma container returns results consistent with my local machine. See below. I've been trying to figure out a way to get uptime-kuma to actually show the response it receives upon an error. When I switch to HTTP(s) - Keyword I get this: Which led me to add "Accept: application/json" to the headers. After adding that header it's working. If the error was handled better (like in Keyword) I wouldn't have ever opened this issue. |
Interesting. uptime-kuma/server/model/monitor.js Line 480 in cf2d603
As far as I understand our options, Maybe we should also change the Headsup to @chakflying given the planned work in #3919 A more long-term symptom-fix would be to allow expanding error messages with additional details (i.e. click on the error message => see the whole request). |
Accept
-Header for the json-query
monitor
That makes a ton of sense, but shouldn't the json-query job only accept application/json? Considering it's explicitly specified in the monitor name? |
Counter question: Why should it only accept json? See #4423 for a related issue where processing |
Just because we can parse plain text with jsonata doesn't mean we should. I'd vote for a monitor that parses via regex for something plain text. It allows for implicit accepts headers in each job and reduces the amount of documentation necessary for edge cases like parsing plain text in a json query monitor. TL;DR: When I use a monitor that says JSON Query, I expect it to work exclusively for JSON. If I have something like a regex parser I will expect it to be able to parse effectively any HTTP text response, including JSON. |
📑 I have found these related issues/pull requests
I wasn't able to find any similar issues.
🛡️ Security Policy
Description
Any time I attempt to use a query I receive Unexpected token < in JSON at position 0
👟 Reproduction steps
Create a monitor that uses header authentication with the JSON Query monitor.
Given the following JSON response:
{"importantnumber":98,"number":0,"failures":8276,"warnings":0,"lastprocessed":"2024-02-14T00:48:15.837Z"}
and the JSON query
($.importantnumber < 1000)
, the response should be "true"👀 Expected behavior
Monitor should show the status as up.
😓 Actual Behavior
Monitor throws an error and cannot get status
🐻 Uptime-Kuma Version
1.23.11
💻 Operating System and Arch
Ubuntu 22.04 (Kubernetes)
🌐 Browser
Brave v1.62.162, Vivaldi 6.5.3206.61
🖥️ Deployment Environment
📝 Relevant log output
The text was updated successfully, but these errors were encountered: