Closed mattgraphlan closed 3 months ago
FWIW, this works in place of ns.query
above:
const url = `https://${process.env.PINECONE_HOST!}/query`;
const res = await fetch(url, {
method: "POST",
headers: {
accept: "application/json",
"Content-Type": "application/json",
"Api-Key": process.env.PINECONE_API_KEY || "unknown",
},
body: JSON.stringify({
includeValues: false,
includeMetadata: true,
topK: topK,
vector: embeddings,
}),
});
const resJson = await res.json();
return resJson;
getting the same error? the above solution didn't work for me.
I'm getting the same error as well. Using the config laid out from the read me
Sorry all for the trouble. Looking into it now.
@jhamon any luck here?
const url = `${process.env.PINECONE_HOST!}/query`;
const res = await fetch(url, {
method: "POST",
headers: {
accept: "application/json",
"Content-Type": "application/json",
"Api-Key": process.env.PINECONE_API_KEY || "unknown",
},
body: JSON.stringify({
includeValues: false,
includeMetadata: true,
topK: <topK>,
vector: embeddings,
namespace: <namespace>,
}),
});
const resJson = await res.json() as QueryResponse<RecordMetadata>;
This worked for me.
Is anyone seeing this error outside of a next.js context? My working theory is that the fetch implementation is missing/non-functional due to next.js stubbing out the cross-fetch polyfill we rely on. But if people are also seeing this outside the context of a next.js app, we might be dealing with multiple unrelated issues that result in similar errors.
I think I've solved this issue in the v1.1.0 release. Please upgrade and let us know if you're still having a problem with this.
I think I've solved this issue in the v1.1.0 release. Please upgrade and let us know if you're still having a problem with this.
Updated the package but still facing the issue
error querying embeddings [TypeError: Cannot read properties of undefined (reading 'text')] ⨯ node_modules\next\dist\esm\server\future\route-modules\app-route\module.js (200:34) @ eval ⨯ No response is returned from route handler 'C:\Users\nipun\Documents\pdfchat\pdfchat\src\app\api\chat\route.ts'. Ensure you return a
Responseor a
NextResponsein all branches of your handler. null
@Nipunwalia08 From that stacktrace alone I'm not sure that this is a Pinecone error. Can you open a fresh issue in this repo (just to focus the discussion around your situation) and include some additional info about what you have in your src/app/api/chat/route.ts
file, your next.js version, etc?
@jhamon thanks for taking a look and fixing the issue in a new release!
Interestingly enough, I am getting this issue (with the same stack trace as OP) when upserting. I created a simple PDF from which to debug to see if any of the created vectors contained undefined metadata that would cause the reading of the text property to error out.
Just to start the conversation, would there be any resemblance between the ns.query() and the ns.upsert()'s implementation of the cross-fetch polyfill that pinecone relies on? Let me know if anything jumps out at first glance; otherwise, I will open a fresh issue with further details.
@jhamon thanks for taking a look and fixing the issue in a new release!
Interestingly enough, I am getting this issue (with the same stack trace as OP) when upserting. I created a simple PDF from which to debug to see if any of the created vectors contained undefined metadata that would cause the reading of the text property to error out.
Just to start the conversation, would there be any resemblance between the ns.query() and the ns.upsert()'s implementation of the cross-fetch polyfill that pinecone relies on? Let me know if anything jumps out at first glance; otherwise, I will open a fresh issue with further details.
I'm wondering if there is something happening that is tied to a specific version of nextjs, since I did a lot of hands-on testing with our pinecone-vercel-starter
(see the upgrade/troubleshooting saga here) where I was able to repro the issue with 1.0.1
and see it resolved in 1.1.0
after adding in some additional logic about when to use cross-fetch. That's why I closed this issue, since the original filers have not chimed in to say the problem was ongoing and I had confidence from my own testing.
The missing text()
error is not related to metadata. It happens when calling extractMessage
in this handleApiError
error handler function. There are a couple of different error callbacks involved here, but by the time this function is executing 1) an error occurred 2) handleFetchError
already checked whether the error is a FetchError
(occurs when a fetch is made but no server response comes back, either due to a misconfiguration, a Pinecone outage, or other network problem affecting the request) and so 3) we expect any errors left over are ResponseError
(i.e. non-200 HTTP responses). .text()
is expected on ResponseError
objects, but whatever is being thrown here is evidently something else that does not have this method.
It seems like there is at least one other error case not covered here (i.e. FetchError and ResponseError are not the only things that can occur). I should check rather than casting here to avoid masking the real issue.
I just shipped a v1.1.1
release that I don't think will completely fix the problem but will hopefully result in a more useful error message than Cannot read properties of undefined (reading 'text')
If anyone experiencing this problem can share full details about your environment and dependencies (ideally a minimum reproduction case), that would be very helpful. So far I have not been able to reproduce the issue in our sample projects and integration tests.
Specifically it would help me to know:
dependencies
does your project have in project.json
?I appreciate everyone's patience as we work through this.
@jhamon Hello again,
I'm using Sveltekit so the problem is very likely NodeJS/Vercel related, not NextJS.
Pre v1.1.1 the titled error is thrown when using Vercel Serverless or Edge; both fail.
Once updated to v1.1.1 the new error is as follows:
error code: 525 Status: 525. (Probably a failed SSL Handshake)
error: PineconeUnmappedHttpError: An unexpected error occured while calling the https://rs-6d43a5d.svc.northamerica-northeast1-gcp.pinecone.io/query endpoint. error code: 525 Status: 525.
at (../../../../node_modules/.pnpm/@pinecone-database+pinecone@1.1.1/node_modules/@pinecone-database/pinecone/src/errors/http.ts:162:12)
at (../../../../node_modules/.pnpm/@pinecone-database+pinecone@1.1.1/node_modules/@pinecone-database/pinecone/src/errors/handling.ts:22:30)
at (../../../../node_modules/.pnpm/@pinecone-database+pinecone@1.1.1/node_modules/@pinecone-database/pinecone/src/errors/utils.ts:4:27)
at (../../../../node_modules/.pnpm/@pinecone-database+pinecone@1.1.1/node_modules/@pinecone-database/pinecone/src/errors/utils.ts:4:27)
at (../../../../node_modules/.pnpm/@pinecone-database+pinecone@1.1.1/node_modules/@pinecone-database/pinecone/src/errors/utils.ts:4:27) {
name: 'PineconeUnmappedHttpError',
cause: undefined
}
Thank you and let me know if theres anything I can test to help resolve this.
@jhamon Any update/thoughts on this? Not being able to use Vercel is a critical hit
Can we please have a progress update here? I need to know if there's anything I can do to help or if Pinecone is abandoning vercel. If so I'll need to sprint to pgvector to meet my teams release date because currently every single npm version of pincone is erroring out. Thank you
As this issue is almost a year old, I'll go ahead and close this as stale. However please feel free to reopen or file a new issue if you're still having trouble here - thank you!
Is this a new bug?
Current Behavior
I'm migrating to v1 as described in https://github.com/pinecone-io/pinecone-ts-client/blob/main/v1-migration.md#query
I can upsert after migrating just fine, but I can't query. My code is as follows:
I have verified that there are actually embeddings (
RecordValues
).The stack trace is a bit unhelpful:
Any ideas?
Expected Behavior
No error to be thrown by
ns.query
, or, a helpful error message or stack trace.Steps To Reproduce
See current behavior code.
Relevant log output
No response
Environment
Additional Context
No response