res.data.includes is not a function #8

Closed
opened 2026-02-28 01:31:34 -05:00 by deekerman · 8 comments
Owner

Originally created by @0mni on GitHub (Jul 11, 2021).

Getting this message with a "HTTP(s) - Keyword" service.

Let me know what you may need to help diagnose the issue, the logs are pretty empty.

Originally created by @0mni on GitHub (Jul 11, 2021). Getting this message with a "HTTP(s) - Keyword" service. Let me know what you may need to help diagnose the issue, the logs are pretty empty.
deekerman 2026-02-28 01:31:34 -05:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@louislam commented on GitHub (Jul 11, 2021):

My guess is the response data is a JSON object and Uptime Kuma currently support html only. I will try to improve it.

@louislam commented on GitHub (Jul 11, 2021): My guess is the response data is a JSON object and Uptime Kuma currently support html only. I will try to improve it.
Author
Owner

@0mni commented on GitHub (Jul 12, 2021):

Not a JSON object, at least I don't think it could be. It was the response I got when I configured a check for my SMTP port 587 on my mailcow server.

Edit: ignore above, was thinking of smtp, on mobile.

I have two files located on my server served by nginx/php-fpm.

One is a static index.html that is blank except for the number "42".
The other is a php script with the following code:

<?php
echo "4";
echo "2";

I do a check for each file as a seperate service and both checks are used to let me know that my webserver is okay, of course the php check will fail if nginx is down, but that is to be expected.

Maybe the check you do is expecting a particular format? Instead of just a simple response?

@0mni commented on GitHub (Jul 12, 2021): <del>Not a JSON object, at least I don't think it could be. It was the response I got when I configured a check for my SMTP port 587 on my mailcow server.</del> Edit: ignore above, was thinking of smtp, on mobile. I have two files located on my server served by nginx/php-fpm. One is a static index.html that is blank except for the number "42". The other is a php script with the following code: ``` <?php echo "4"; echo "2"; ``` I do a check for each file as a seperate service and both checks are used to let me know that my webserver is okay, of course the php check will fail if nginx is down, but that is to be expected. Maybe the check you do is expecting a particular format? Instead of just a simple response?
Author
Owner

@louislam commented on GitHub (Jul 12, 2021):

Not a JSON object, at least I don't think it could be. It was the response I got when I configured a check for my SMTP port 587 on my mailcow server.

Edit: ignore above, was thinking of smtp, on mobile.

I have two files located on my server served by nginx/php-fpm.

One is a static index.html that is blank except for the number "42".
The other is a php script with the following code:

<?php
echo "4";
echo "2";

I do a check for each file as a seperate service and both checks are used to let me know that my webserver is okay, of course the php check will fail if nginx is down, but that is to be expected.

Maybe the check you do is expecting a particular format? Instead of just a simple response?

I am sorry that I am a bit lost. Do you mean the error you mentioned at the topic, is related to index.html/index.php hosted on nginx/php-fpm server?

@louislam commented on GitHub (Jul 12, 2021): > ~Not a JSON object, at least I don't think it could be. It was the response I got when I configured a check for my SMTP port 587 on my mailcow server.~ > > Edit: ignore above, was thinking of smtp, on mobile. > > I have two files located on my server served by nginx/php-fpm. > > One is a static index.html that is blank except for the number "42". > The other is a php script with the following code: > > ``` > <?php > echo "4"; > echo "2"; > ``` > > I do a check for each file as a seperate service and both checks are used to let me know that my webserver is okay, of course the php check will fail if nginx is down, but that is to be expected. > > Maybe the check you do is expecting a particular format? Instead of just a simple response? I am sorry that I am a bit lost. Do you mean the error you mentioned at the topic, is related to index.html/index.php hosted on nginx/php-fpm server?
Author
Owner

@0mni commented on GitHub (Jul 12, 2021):

I am sorry that I am a bit lost. Do you mean the error you mentioned at the topic, is related to index.html/index.php hosted on nginx/php-fpm server?

Correct.

@0mni commented on GitHub (Jul 12, 2021): > I am sorry that I am a bit lost. Do you mean the error you mentioned at the topic, is related to index.html/index.php hosted on nginx/php-fpm server? Correct.
Author
Owner

@0mni commented on GitHub (Jul 12, 2021):

Just did a test, I replaced my index.html that used to have:

42

with the following:

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The Answer to the Ultimate Question</title>
</head>
<body>
42
</body>
</html>

It is now functioning, so I think you are on the right track that it is a issue with the way the response is being handled. Maybe don't check if it is valid HTML? Just parse the data for the keyword it gets on the response?

@0mni commented on GitHub (Jul 12, 2021): Just did a test, I replaced my index.html that used to have: ``` 42 ``` with the following: ``` <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>The Answer to the Ultimate Question</title> </head> <body> 42 </body> </html> ``` It is now functioning, so I think you are on the right track that it is a issue with the way the response is being handled. Maybe don't check if it is valid HTML? Just parse the data for the keyword it gets on the response?
Author
Owner

@0mni commented on GitHub (Jul 12, 2021):

I made the same change to my php script, it too now works as expected:

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The Answer to the Ultimate Question</title>
</head>
<body>
<?php

echo "4";
echo "2";

?>
</body>
</html>
@0mni commented on GitHub (Jul 12, 2021): I made the same change to my php script, it too now works as expected: ``` <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>The Answer to the Ultimate Question</title> </head> <body> <?php echo "4"; echo "2"; ?> </body> </html> ```
Author
Owner

@louislam commented on GitHub (Jul 12, 2021):

Found the root problem, because axios automatically parse the response "42" to number format.

Lucky, JSON.stringify can also fix the problem even though it is not a json.

Thank you for your special case.

@louislam commented on GitHub (Jul 12, 2021): Found the root problem, because axios automatically parse the response "42" to number format. Lucky, JSON.stringify can also fix the problem even though it is not a json. Thank you for your special case.
Author
Owner

@louislam commented on GitHub (Jul 12, 2021):

Fixed with 1.0.1

@louislam commented on GitHub (Jul 12, 2021): Fixed with 1.0.1
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/uptime-kuma#8
No description provided.