Skip to content

Commit ffbec54

Browse files
committed
fix(rivetkit): revert remove client-side connection request size check
1 parent 52e743c commit ffbec54

2 files changed

Lines changed: 6 additions & 30 deletions

File tree

rivetkit-typescript/packages/rivetkit/src/client/actor-conn.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,34 +1280,8 @@ export class ActorConnRaw {
12801280
}
12811281
},
12821282
);
1283-
const serializedLength = messageLength(messageSerialized);
1284-
if (
1285-
serializedLength > DEFAULT_MAX_INCOMING_MESSAGE_SIZE &&
1286-
message.body.tag === "ActionRequest"
1287-
) {
1288-
const actionId = Number(message.body.val.id);
1289-
const inFlight = this.#takeActionInFlight(actionId);
1290-
const error = new errors.ActorError(
1291-
"message",
1292-
"incoming_too_long",
1293-
"Incoming message too long",
1294-
{
1295-
maxSize: DEFAULT_MAX_INCOMING_MESSAGE_SIZE,
1296-
actualSize: serializedLength,
1297-
},
1298-
);
1299-
logger().warn({
1300-
msg: "rejecting oversized connection action request",
1301-
actionId,
1302-
actionName: inFlight.name,
1303-
actualSize: serializedLength,
1304-
maxSize: DEFAULT_MAX_INCOMING_MESSAGE_SIZE,
1305-
});
1306-
inFlight.reject(error);
1307-
this.#dispatchActorError(error);
1308-
return;
1309-
}
13101283
this.#websocket.send(messageSerialized);
1284+
const serializedLength = messageLength(messageSerialized);
13111285
logger().trace({
13121286
msg: "sent websocket message",
13131287
len: serializedLength,

rivetkit-typescript/packages/rivetkit/tests/driver/actor-conn.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,16 +707,18 @@ describeDriverMatrix("Actor Conn", (driverTestConfig) => {
707707
await connection.dispose();
708708
});
709709

710-
test("should reject request exceeding maxIncomingMessageSize", async (c) => {
710+
test("should reject request exceeding maxIncomingMessageSize via server", async (c) => {
711711
const { client } = await setupDriverTest(c, driverTestConfig);
712712

713713
const handle = client.largePayloadConnActor.getOrCreate([
714714
"test-large-request-exceed",
715715
]);
716716
const connection = handle.connect();
717717

718-
// Create a payload that exceeds the default 64KB limit
719-
// Each item is roughly 60 bytes, so 1500 items ≈ 90KB
718+
// Create a payload that exceeds the default 64KB limit.
719+
// Each item is roughly 60 bytes, so 1500 items ~ 90KB.
720+
// The server enforces the limit and closes the WebSocket
721+
// with reason "message.incoming_too_long".
720722
const items: string[] = [];
721723
for (let i = 0; i < 1500; i++) {
722724
items.push(

0 commit comments

Comments
 (0)