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

res.data.includes is not a function #10

Closed
0mni opened this issue Jul 11, 2021 · 8 comments
Closed

res.data.includes is not a function #10

0mni opened this issue Jul 11, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@0mni
Copy link

0mni commented 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.

@louislam louislam added the bug Something isn't working label Jul 12, 2021
@louislam
Copy link
Owner

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

@0mni
Copy link
Author

0mni commented 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?

@louislam
Copy link
Owner

louislam commented 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?

@0mni
Copy link
Author

0mni commented 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
Copy link
Author

0mni commented 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
Copy link
Author

0mni commented 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>

@louislam
Copy link
Owner

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
Copy link
Owner

Fixed with 1.0.1

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

No branches or pull requests

2 participants