Hey all. I have a Next.js app and implementing Pinecone the following way:
import { PineconeClient, Vector } from "@pinecone-database/pinecone";
export async function uploadToPinecone(embeddings, rows) {
await pinecone.init({ apiKey, environment });
const index = pinecone.Index("main-index");
const vectors = rows.map((row, i) => ({
id: i,
values: embeddings,
}));
const upsertRequest = { vectors, namespace: "main-namespace" };
await index.upsert({ upsertRequest });
}
I have tried:
- moving the function directly to the /api route
- next.js config settings to render pages static
- packages like into-stream for readable streams (was assuming that wouldnt work)
I was wondering about compatibility with next.js but then I saw the pinecone example using next.js.
I have tried many different ways to resolve this error but am not finding any luck. Any ideas?