I have a problem with Pinecone upsert from google firebase function

120 Views Asked by At

The problem is undeterministic. In most cases it doesn’t work, rarely it does.

I experimented with different number of vectors sent to Pinecone, and currently has upsert 5 vectors at a time. And here is example of a vector:

{
id: 'f0b21772-d582-415f-8af3-8d0844cb6165',
values: [ -0.024082549, -0.0092171095, -0.023572724, -0.03410465,...]
}

And here is my code:

const indexName = "namespace_name" 
const projectKey = "projectkey_in_string"
const namespaceIndex = pineconeClient.Index(indexName).namespace(projectKey);
const v: {"id": string, "values": number[]}[] = [my vectors]
namespaceIndex.upsert(v).then(result => {
    console.log("successfully upserted vectors to pinecone")
  }).catch(error => {
    console.log("there was error while upserting vectors")
    console.log(error)
  }))

The problem is that upsert function doesn’t return anything, neither success message, nor error. After a while Google returns this mesage: Exception from a finished function: Error: 4 DEADLINE_EXCEEDED: Deadline exceeded

My firebase function has 2000 seconds timeout set, and the last message appears after about 10 minutes.

I tried various numbers of vectors sent a time, various documents vectorized from short to long.

1

There are 1 best solutions below

0
On

I had issues with upserting Pinecone vectors where my cloud function (also Firebase in this example, but I think that's irrelevant) timed out after 60 seconds with just a single upsert.

Realized eventually that I was passing undefined as the vector ID. Weird that it would time out instead of producing an error but that might be what's happening for you as well!