Elliott-Chong / chatpdf-yt

https://chatpdf-elliott.vercel.app
694 stars 284 forks source link

TypeError: Cannot read properties of undefined (reading 'text') #23

Open Scott-Zeta opened 11 months ago

Scott-Zeta commented 11 months ago

I keep encountering with the error

TypeError: Cannot read properties of undefined (reading 'text')
    at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/utils.js:136:40)
    at step (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/utils.js:107:23)
    at Object.eval [as next] (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/utils.js:48:20)
    at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/utils.js:26:71)
    at new Promise (<anonymous>)
    at __awaiter (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/utils.js:8:12)
    at extractMessage (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/utils.js:129:12)
    at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:178:76)
    at step (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:107:23)
    at Object.eval [as next] (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:48:20)
    at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:26:71)
    at new Promise (<anonymous>)
    at __awaiter (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:8:12)
    at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:171:36)
    at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:151:25)
    at step (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:107:23)
    at Object.eval [as next] (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:48:20)
    at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:26:71)
    at new Promise (<anonymous>)
    at __awaiter (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:8:12)
    at handleFetchError (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:136:12)
    at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:170:54)
    at step (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:107:23)
    at Object.eval [as next] (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:48:20)
    at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:26:71)
    at new Promise (<anonymous>)
    at __awaiter (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:8:12)
    at handleApiError (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/errors/handling.js:164:12)
    at UpsertCommand.eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/data/upsert.js:178:57)
    at step (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/data/upsert.js:107:23)
    at Object.eval [as throw] (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/data/upsert.js:48:20)
    at rejected (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/data/upsert.js:18:40)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

When trying to upsert vectors to Pinecone. I think the 'text' does not refer to the text varibale I am trying to upsert. And not only the upsert, any operation would return this error.

I search on internet and there is a similar situation, don't know if they are relative. https://github.com/pinecone-io/pinecone-ts-client/issues/124 Here is my code and welcome to judge. https://github.com/Scott-Zeta/chatpdf/blob/main/src/lib/pinecone.ts Thanks!

mario-oliver commented 11 months ago

It's an issue with the pinecone sdk interaction with next.js, sadly. You will encounter the same issue when using pinecone.query(). Here's the current thread on the pinecone sdk to attempt to fix this issue. https://github.com/pinecone-io/pinecone-ts-client/issues/124 If you are looking for an immediate solution, then considering creating a fetch or axios.post() request directly to the pinecone api for upsert() and for query(). It was the fastest solution while the pinecone team implements a fix from the polyfill cross-fetch issue with next.js. From that thread here is someone's solution implementing the aforementioned work-around - https://github.com/pinecone-io/pinecone-ts-client/issues/124#issuecomment-1732705065

Scott-Zeta commented 11 months ago

It's an issue with the pinecone sdk interaction with next.js, sadly. You will encounter the same issue when using pinecone.query(). Here's the current thread on the pinecone sdk to attempt to fix this issue. pinecone-io/pinecone-ts-client#124 If you are looking for an immediate solution, then considering creating a fetch or axios.post() request directly to the pinecone api for upsert() and for query(). It was the fastest solution while the pinecone team implements a fix from the polyfill cross-fetch issue with next.js. From that thread here is someone's solution implementing the aforementioned work-around - pinecone-io/pinecone-ts-client#124 (comment)

I have successfully uploaded my first vectors to Pinecone, Great thanks! Hope it could be smooth in following steps.