Skip to content

Commit

Permalink
Add assert for eTags and uploadLinks (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
callingmedic911 authored Jul 2, 2024
1 parent 543dfc9 commit 4f1dd73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/replay/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getPackument } from "query-registry";
import { compare } from "semver";
import dbg from "./debug";
import { getCurrentVersion, getHttpAgent } from "./utils";
import assert from "node:assert/strict";

// requiring v4 explicitly because it's the last version with commonjs support.
// Should be upgraded to the latest when converting this code to es modules.
Expand Down Expand Up @@ -241,6 +242,8 @@ async function multipartUploadRecording(
agentOptions
);

assert(eTags.length === partLinks.length, "Mismatched eTags and partLinks");

await client.connectionEndRecordingMultipartUpload(recording.id, uploadId, eTags);
return recordingId;
}
Expand Down
3 changes: 3 additions & 0 deletions packages/test-utils/src/legacy-cli/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { retryWithExponentialBackoff } from "@replay-cli/shared/async/retryOnFai
import fs from "fs";
import dbg from "./debug";
import { getHttpAgent } from "./utils";
import assert from "node:assert/strict";

// requiring v4 explicitly because it's the last version with commonjs support.
// Should be upgraded to the latest when converting this code to es modules.
Expand Down Expand Up @@ -226,6 +227,8 @@ async function multipartUploadRecording(
agentOptions
);

assert(eTags.length === partLinks.length, "Mismatched eTags and partLinks");

await client.connectionEndRecordingMultipartUpload(recording.id, uploadId, eTags);
return recordingId;
}
Expand Down

0 comments on commit 4f1dd73

Please sign in to comment.