Frame_too_long

Created at 03 Jan 2022, 14:42
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
BU

budda_dan2020

Joined 10.09.2020

Frame_too_long
03 Jan 2022, 14:42


Hi,

i had several apps using open Api which are working fine several months.

But they can not connect to Server since 1/3/2022 or maybe since 1/1/2022.

If apps try to authorize the app, following error message is received.

2022-01-03 15:38:16.1266|INFO|CTraderAPILog|Send: "ProtoMessage{AppAuthRequest{clientId:2205_uLmO5Tke92q7Y8qTKf9wECf9ewlqezWRswlhiT9Z2FbwwHR23V, clientSecret:d0iNc3cxWd........}}"
2022-01-03 15:38:16.5990|INFO|CTraderAPILog|Received: "ProtoMessage{ErrorResponse{errorCode:FRAME_TOO_LONG, description:Frame size exceeds allowed limit.}}"
2022-01-03 15:38:16.5990|INFO|MainLog|FRAME_TOO_LONG:Frame size exceeds allowed limit.

This happes at all of apps I developed and used since days ago.

Is anything changed in open Api connection?

Kind regards


@budda_dan2020
Replies

amusleh
04 Jan 2022, 08:54

Hi,

We are aware of this issue and we are investigating to find the cause of it.

Thanks for reporting.


@amusleh

budda_dan2020
04 Jan 2022, 22:01

RE: Any update?

amusleh said:

Hi,

We are aware of this issue and we are investigating to find the cause of it.

Thanks for reporting.

Hi Amusleh,

is there any update about issue?

I can not run the app since two days. 

Can a new app with new auth datas work?

Kind regards


@budda_dan2020

amusleh
05 Jan 2022, 09:13

RE: RE: Any update?

budda_dan2020 said:

amusleh said:

Hi,

We are aware of this issue and we are investigating to find the cause of it.

Thanks for reporting.

Hi Amusleh,

is there any update about issue?

I can not run the app since two days. 

Can a new app with new auth datas work?

Kind regards

Hi,

The issue is not fixed yet, we are working on it and it will be fixed ASAP.

Thanks for you patience.


@amusleh

dominhtri1995
05 Jan 2022, 09:25

This is happening to us as well. Looks like a big issue since any new connection will not work and you can't reset your token either. Please help fix it asap.


@dominhtri1995

amusleh
11 Jan 2022, 12:46

Hi,

The issue has been resolved.

Please try our .NET samples on OpenAPI.NET repository: spotware/OpenAPI.Net: Spotware Open API .NET Rx library (github.com)

The old samples might not work.


@amusleh

50639902
17 Aug 2022, 17:35

RE: encountered again.

amusleh said:

Hi,

The issue has been resolved.

Please try our .NET samples on OpenAPI.NET repository: spotware/OpenAPI.Net: Spotware Open API .NET Rx library (github.com)

The old samples might not work.

Hi, smusleh. I use openapi protobuf with erlang and golang, and encountered this problem again. even filled with a wrong but short clientId and clientSecret, the server returned ProtoOAErrorRes,

The following is my program log:

22:32:48.197 [info] SSL Socket {sslsocket,{gen_tcp,#Port<0.7>,tls_connection,undefined},[<0.311.0>,<0.310.0>]}
22:32:48.197 [info] ssl connected to {172,104,44,101}:5035
22:32:50.260 [info] sending Item: {'ProtoOAApplicationAuthReq','PROTO_OA_APPLICATION_AUTH_REQ',<<"abc">>,<<"not a sec">>} with binary: <<24,0,0,0,8,180,16,18,19,8,180,16,18,3,97,98,99,26,9,110,111,116,32,97,32,115,101,99>>
22:32:53.200 [info] ProtoMessageBinary = <<8,222,16,18,51,26,14,70,82,65,77,69,95,84,79,79,95,76,79,78,71,34,33,70,114,97,109,101,32,115,105,122,101,32,101,120,99,101,101,100,115,32,97,108,108,111,119,101,100,32,108,105,109,105,116,46>>
22:32:53.200 [info] Received = {'ProtoOAErrorRes',undefined,undefined,<<"FRAME_TOO_LONG">>,<<"Frame size exceeds allowed limit.">>,undefined}


@50639902

DevChris
18 Aug 2023, 15:25 ( Updated at: 18 Aug 2023, 15:31 )

Same problem today using rust with tokio::TcpStream with tokio_openssl::SslStream,

the code:

 println!("connecting to server: {:?}", PROTOBUF_DEMO_ENDPOINT);
    let stream = TcpStream::connect(&PROTOBUF_DEMO_ENDPOINT).await?;
    println!("connected to server: {:?}", stream.peer_addr()?);
    let conn_builder = SslConnector::builder(SslMethod::tls())?;
    let mut conn_config = conn_builder.build().configure()?;
    // conn_config.set_max_proto_version(Some(SslVersion::TLS1_1))?;
    // conn_config.set_verify(SslVerifyMode::NONE);
    let ssl = conn_config.into_ssl("ctraderapi.com")?;
    println!("ssl: {}", ssl.version_str());
    let mut stream = SslStream::new(ssl, stream).unwrap();
    Pin::new(&mut stream).connect().await.unwrap();

    let mut app_auth = ProtoOaApplicationAuthReq::default();
    app_auth.client_id = CLIENT_ID.to_string();
    app_auth.client_secret = CLIENT_SECRET.to_string();
    let buf = serialize(&app_auth);
    println!("sending app auth ({})", buf.len());
    stream.write_all(&buf).await.unwrap();

    let mut buf = Vec::new();
    buf.resize(4096, 0);
    let data = stream.read(&mut buf).await.unwrap();
    println!("received {} bytes", data);
    println!("buf: {:?}", &buf[..data]);

    let str = String::from_utf8_lossy(&buf[..data]);
    println!("str: {}", str);

the logs:

connecting to server: "demo.ctraderapi.com:5035"
connected to server: 15.197.239.248:5035
ssl: TLSv1.3
sending app auth (113)
received 60 bytes
buf: [0, 0, 0, 56, 8, 222, 16, 18, 51, 26, 14, 70, 82, 65, 77, 69, 95, 84, 79, 79, 95, 76, 79, 78, 71, 34, 33, 70, 114, 97, 109, 101, 32, 115, 105, 122, 101, 32, 101, 120, 99, 101, 101, 100, 115, 32, 97, 108, 108, 111, 119, 101, 100, 32, 108, 105, 109, 105, 116, 46]
str: �3FRAME_TOO_LONG"!Frame size exceeds allowed limit.

@DevChris

alshdavid
02 Nov 2024, 06:34 ( Updated at: 03 Nov 2024, 12:59 )

I am also getting this error. I am trying to simplify this with a Nodejs client (will use Rust for production)

const root = protobuf.loadSync(path.join(__dirname, '..', 'protobuf', 'OpenApiMessages.proto'))
const ProtoOAApplicationAuthReq = root.lookupType("ProtoOAApplicationAuthReq");

const client = new net.Socket();

await new Promise<void>(res => client.connect(5035, "demo.ctraderapi.com", res))
console.log('Connected')

const socket = new tls.TLSSocket(client)

const msg = ProtoOAApplicationAuthReq.create({
  clientId: CLIENT_ID,
  clientSecret: CLIENT_SECRET,
});

let bytes = ProtoOAApplicationAuthReq.encode(msg).finish()
socket.write(bytes)

socket.on('data', function(data) {
  console.log('Received: ' + data);
});

I also tried sending the bytes individually to see if that was the problem

let bytes = ProtoOAApplicationAuthReq.encode(msg).finish()

for (const byte of bytes) {
  socket.write(Buffer.from([byte]))
}

However both resulted in

FRAME_TOO_LONG"!Frame size exceeds allowed limit.

I tried adding the length header

function len(x: number) {
  return [x,(x<<8),(x<<16),(x<<24)].map(z=> z>>>24).reverse()
}

console.log(bytes.length)      // 110
console.log(len(bytes.length)) // [110, 0, 0, 0]

// +--------------------------+-----------------------------------------+  
// | Message Length (4 bytes) | Serialized ProtoMessage object (byte[]) |  
// +--------------------------+-----------------------------------------+  
//                            |<---------- Message Length ------------->|
const b = Buffer.from([...len(bytes.length),...bytes])

console.log(b)  // [110, 0, 0, 0, ...proto bytes]

socket.write(b)

Same error


@alshdavid

alshdavid
03 Nov 2024, 12:58

This is also the case with Golang


func main() {
	var HOST string = "demo.ctraderapi.com"
	var PORT uint32 = 5035
	var CLIENT_ID string = "<x>"
	var CLIENT_SECRET string = "<x>"

	addr := fmt.Sprintf("%s:%d", HOST, PORT)
	tcpAddr, _ := net.ResolveTCPAddr("tcp", addr)
	iconn, _ := net.DialTCP("tcp", nil, tcpAddr)

	cfg := tls.Config{
		InsecureSkipVerify: true,
	}
	conn := tls.Client(iconn, &cfg)

	req := &openapi.ProtoOAApplicationAuthReq{
		PayloadType:  nil,
		ClientId:     &CLIENT_ID,
		ClientSecret: &CLIENT_SECRET,
	}

	out, _ := proto.Marshal(req)

	length := make([]uint8, 5)
	binary.LittleEndian.PutUint32(length[0:4], uint32(len(out)))
	out = append(length, out...)

	conn.Write(out)

	for {
		buffer := make([]byte, 1024)
		conn.Read(buffer)
		fmt.Print("Response:", string(buffer))
	}

}

Failing with 

FRAME_TOO_LONG"!Frame size exceeds allowed limit.

@alshdavid