Description
When creating a replay session from a raw HTTP request using client.replay.sessions.create({ requestSource: { raw, connection } }), the SDK passes the raw string directly to the GraphQL mutation. However, Caido's GraphQL schema expects the raw field inside RequestRawInput to be a Blob type (base64-encoded string).
This causes the following error:
Error: [GraphQL] Expected input type "Blob", found "GET / HTTP/1.1\r\n...".
(occurred while parsing "RequestRawInput")
(occurred while parsing "RequestSourceInput")
(occurred while parsing "CreateReplaySessionInput")
Root Cause
Looking at the SDK source, mapRequestSource() passes requestSource.raw through as-is:
const mapRequestSource = (requestSource) => {
if ("id" in requestSource) return { id: requestSource.id };
return { raw: {
connectionInfo: requestSource.connection,
raw: requestSource.raw // <-- not encoded
}};
};
But replay.send() correctly uses encodeBlob() on the raw field:
raw: encodeBlob(options.raw)
So send() works fine, but sessions.create() with a raw source doesn't.
Workaround
Manual base64 encoding via client.graphql.mutation():
const result = await client.graphql.mutation(CREATE_REPLAY_SESSION_RAW, {
input: {
kind: "HTTP",
requestSource: {
raw: {
connectionInfo: { host, port, isTLS: tls },
raw: Buffer.from(rawRequest).toString("base64"),
},
},
},
});
Environment
@caido/sdk-client: 0.4.0
- Caido: 0.57.0
Expected Behavior
sessions.create({ requestSource: { raw: "GET / HTTP/1.1\r\n...", connection: {...} } }) should automatically base64-encode the raw field before sending to GraphQL, similar to how replay.send() handles it.
Description
When creating a replay session from a raw HTTP request using
client.replay.sessions.create({ requestSource: { raw, connection } }), the SDK passes the raw string directly to the GraphQL mutation. However, Caido's GraphQL schema expects therawfield insideRequestRawInputto be aBlobtype (base64-encoded string).This causes the following error:
Root Cause
Looking at the SDK source,
mapRequestSource()passesrequestSource.rawthrough as-is:But
replay.send()correctly usesencodeBlob()on the raw field:So
send()works fine, butsessions.create()with a raw source doesn't.Workaround
Manual base64 encoding via
client.graphql.mutation():Environment
@caido/sdk-client: 0.4.0Expected Behavior
sessions.create({ requestSource: { raw: "GET / HTTP/1.1\r\n...", connection: {...} } })should automatically base64-encode the raw field before sending to GraphQL, similar to howreplay.send()handles it.