uptime-kuma icon indicating copy to clipboard operation
uptime-kuma copied to clipboard

gRPC check throws errors

Open otbutz opened this issue 2 years ago β€’ 12 comments

⚠️ Please verify that this bug has NOT been raised before.

  • [X] I checked and didn't find similar issue

πŸ›‘οΈ Security Policy

Description

The gRPC check fails but i get the expected output in bloomrpc.

πŸ‘Ÿ Reproduction steps

URL: routing.ot-hosting.de:443

Keyword: version

Enable TLS: :heavy_check_mark:

Proto Service Name:

service.v1.RoutingService

Proto Method:

Info

Proto Content:

syntax = "proto3";

package service.v1;

message Envelope {
    double min_longitude = 1;
    double max_longitude = 2;
    double min_latitude = 3;
    double max_latitude = 4;
}

message InfoRequest {
}

message InfoResponse {
  string version = 1;
  string gh_version = 2;
  int64 data_timestamp = 3;
  Envelope bounding_box = 4;
  map<string,string> configuration = 5;
}

service RoutingService {
    rpc Info (InfoRequest) returns (InfoResponse);
}

Body:

{}

πŸ‘€ Expected behavior

image

πŸ˜“ Actual Behavior

Depending on the case of the method Info/info i get the following errors:

WARN: Monitor #67 'routing': Failing: response.substring is not a function | Interval: 60 seconds | Type: grpc-keyword | Down Count: 0 | Resend Interval: 0
WARN: Monitor #67 'routing': Failing: grpcService[grpcMethod] is not a function | Interval: 60 seconds | Type: grpc-keyword | Down Count: 0 | Resend Interval: 0

🐻 Uptime-Kuma Version

1.19.2

πŸ’» Operating System and Arch

Ubuntu 22.04

🌐 Browser

Firefox

πŸ‹ Docker Version

20.10.22

🟩 NodeJS Version

No response

πŸ“ Relevant log output

No response

otbutz avatar Dec 27 '22 11:12 otbutz

@minhhoangvn

otbutz avatar Dec 27 '22 11:12 otbutz

Could you please share your configuration options for the uptime with gRPC. You can refer to the guideline for testing on this PR https://github.com/louislam/uptime-kuma/pull/1964

minhhoangvn avatar Dec 27 '22 15:12 minhhoangvn

Same settings as noted above in the "reproduction steps" section.

grafik

otbutz avatar Dec 28 '22 08:12 otbutz

Can you try to edit the service name without the package value, in your case is β€œRoutingService”

minhhoangvn avatar Dec 28 '22 09:12 minhhoangvn

Funny. I'm unable to remove the package. Clicking the save button automatically restores the old value.

otbutz avatar Dec 28 '22 09:12 otbutz

Recreated the monitor without the package prefix. Same error.

Info -> grpcService[grpcMethod] is not a function info -> response.substring is not a function

Entering a dummy value for proto method will also trigger grpcService[grpcMethod] is not a function so I assume that info is in fact the correct value. This should be replaced with a more understandable error message IMHO.

otbutz avatar Dec 28 '22 09:12 otbutz

Can you share your proto data, I will double check itπŸ˜…

minhhoangvn avatar Dec 28 '22 10:12 minhhoangvn

syntax = "proto3";

package service.v1;

message Envelope {
    double min_longitude = 1;
    double max_longitude = 2;
    double min_latitude = 3;
    double max_latitude = 4;
}

message InfoRequest {
}

message InfoResponse {
  string version = 1;
  string gh_version = 2;
  int64 data_timestamp = 3;
  Envelope bounding_box = 4;
  map<string,string> configuration = 5;
}

service RoutingService {
    rpc Info (InfoRequest) returns (InfoResponse);
}

otbutz avatar Dec 28 '22 10:12 otbutz

@otbutz, below is the correct configuration for your proto file. I will add the accurate log information and fix the issue when we can't update the service name πŸ˜₯ The logic for updating the gRPC monitor configuration is missed with the service name value. image

minhhoangvn avatar Dec 28 '22 13:12 minhhoangvn

Feel free to use my endpoint for testing. routing.ot-hosting.de:443 with TLS enabled. This is currently not working:

grafik

otbutz avatar Dec 28 '22 13:12 otbutz

@otbutz, thank you for your help in investigating the issue. The root cause is logic to truncate the response data for displaying in monitor info image

https://github.com/louislam/uptime-kuma/blob/8c684e92936b5860139b09e50917d55c0b041891/server/model/monitor.js#L551

I have created a new PR to fix those issues (can't update service name and error when truncating response data)

minhhoangvn avatar Dec 28 '22 15:12 minhhoangvn

Thanks!

otbutz avatar Dec 28 '22 16:12 otbutz