breez / breez-sdk-greenlight

MIT License
241 stars 42 forks source link

impossible connect to gl with breez-sdk-cli #891

Closed vincenzopalazzo closed 7 months ago

vincenzopalazzo commented 7 months ago

I am testing breeze sdk with green and with the breez-sdk-cli and I am getting the same error that I am not able to fix.


The error is

dk> connect -c /home/vincent/Downloads/client-key.pem -k /home/vincent/Downloads/client.crt
Error: Generic: Generic: transport error
sdk> connect -k /home/vincent/Downloads/client-key.pem -c /home/vincent/Downloads/client.crt
Error: Generic: Generic: Generic: status: Internal, message: "protocol error: received message with invalid compression flag: 66 (valid flags are 0 and 1) while receiving response with status: 502 Bad Gateway", details: [], metadata: MetadataMap { headers: {"content-type": "text/plain; charset=utf-8", "content-length": "11", "date": "Sun, 24 Mar 2024 13:35:08 GMT"} }
sdk>
roeierez commented 7 months ago

This is currently a greenlight error returned from the API, I reported that to @cdecker

cdecker commented 7 months ago

Are you using Tonic with the compression feature? I know we have one place where we look into the payload, but that's in the approver in the signer, not in the client. Googling this myself I found a couple of people reporting this error or a similar one on tonic, so I'm tempted to mark this as an upstream issue. Could be a regression, so we could look through the previous versions of tonic to see if pinning might be a quick fix.

cdecker commented 7 months ago

The error originates here by the way:

https://github.com/hyperium/tonic/blob/eeb3268f71ae5d1107c937392389db63d8f721fb/tonic/src/codec/decode.rs#L165-L174

Quite far away from any code we touch ourselves as far as I know.

This is the only code that touches the payloads at the level that'd be required here:

https://github.com/Blockstream/greenlight/blob/08b2accdcb59f4412e2842313f534d21a14d3e64/libs/gl-client/src/node/service.rs#L108-L152

It essentially reads and buffers the request, so it can sign it, and then forwards it unmodified to the server. So it looks like either the server tonic library needs bumping, or the client has a regression and we need to pin it to an earlier version.

Interestingly, when I use glcli locally, which builds on top of gl-client-py and gl-client crate, so the same basis as Breez SDK, it works fine. That to me is an indication that it may be related to different versions of the tonic library getting pulled in.

vincenzopalazzo commented 7 months ago

idk if this can help but it is happening also from green point of view

signal-2024-03-24-130718

let me know if I can help in any way

roeierez commented 7 months ago

@cdecker the same client build worked yesterday. It indicates that it may not be something on the client. Unless this error is somehow not consistent.

vincenzopalazzo commented 7 months ago

Unless this error is somehow not consistent.

it is on green

roeierez commented 7 months ago

@cdecker @vincenzopalazzo sorry, I just realized the LSP API returns this error. We are on it.

roeierez commented 7 months ago

Should be working now