From a9b4f252ccbce4856ffc967e51c0aa8cf2e1bb4f Mon Sep 17 00:00:00 2001 From: Garvit Gupta Date: Fri, 16 Aug 2024 11:13:23 -0500 Subject: [PATCH] VS-197: Fix Vectorize List MetadataIndex Http Method (#6502) * VS-197: Fix Vectorize List MetadataIndex Http Method * Update .changeset/stale-moles-give.md --------- Co-authored-by: Carmen Popoviciu --- .changeset/stale-moles-give.md | 5 +++++ packages/wrangler/src/__tests__/vectorize/vectorize.test.ts | 4 ++-- packages/wrangler/src/vectorize/client.ts | 2 +- packages/wrangler/src/vectorize/query.ts | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/stale-moles-give.md diff --git a/.changeset/stale-moles-give.md b/.changeset/stale-moles-give.md new file mode 100644 index 000000000000..0aa001ff8ac3 --- /dev/null +++ b/.changeset/stale-moles-give.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +fix: Fix Vectorize List MetadataIndex Http Method diff --git a/packages/wrangler/src/__tests__/vectorize/vectorize.test.ts b/packages/wrangler/src/__tests__/vectorize/vectorize.test.ts index 0183ccb547e8..236e0ce01030 100644 --- a/packages/wrangler/src/__tests__/vectorize/vectorize.test.ts +++ b/packages/wrangler/src/__tests__/vectorize/vectorize.test.ts @@ -1088,7 +1088,7 @@ function mockVectorizeV2Request() { }, { once: true } ), - http.post( + http.get( "*/accounts/:accountId/vectorize/v2/indexes/test-index/metadata_index/list", () => { return HttpResponse.json( @@ -1163,7 +1163,7 @@ function mockVectorizeV2RequestError() { }, { once: true } ), - http.post( + http.get( "*/accounts/:accountId/vectorize/v2/indexes/test-index/metadata_index/list", () => { return HttpResponse.json( diff --git a/packages/wrangler/src/vectorize/client.ts b/packages/wrangler/src/vectorize/client.ts index 8bde0f8b1ea0..9289d1416937 100644 --- a/packages/wrangler/src/vectorize/client.ts +++ b/packages/wrangler/src/vectorize/client.ts @@ -221,7 +221,7 @@ export async function listMetadataIndex( return await fetchResult( `/accounts/${accountId}/vectorize/v2/indexes/${indexName}/metadata_index/list`, { - method: "POST", + method: "GET", } ); } diff --git a/packages/wrangler/src/vectorize/query.ts b/packages/wrangler/src/vectorize/query.ts index 36a5eb36feea..a5db796e635c 100644 --- a/packages/wrangler/src/vectorize/query.ts +++ b/packages/wrangler/src/vectorize/query.ts @@ -28,7 +28,7 @@ export function options(yargs: CommonYargsArgv) { type: "array", demandOption: true, describe: - "Vector to query the Vectorize Index. Example: `--vector 1 2 3 0.5 1.25 6`", + "Vector to query the Vectorize Index. Example: `--vector 1 2 3 0.5 1.25 6`. To read from a json file that contains data in the format [1, 2, 3], you could use a command like `--vector $(jq -r '.[]' data.json | xargs)`", coerce: (arg: unknown[]) => arg .map((value) =>