Error [TypeError]: Cannot read properties of undefined (reading ‘custom’)
at (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js:114)
at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js:114:43)
at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js:162:2)
at (rsc)/./node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js (file://C:\Users\anura\OneDrive\Desktop\build\1.learningProduction\pdf.next\server\app\api\chat\route.js:1041:1)
at webpack_require (file://C:\Users\anura\OneDrive\Desktop\build\1.learningProduction\pdf.next\server\edge-runtime-webpack.js:37:33)
at fn (file://C:\Users\anura\OneDrive\Desktop\build\1.learningProduction\pdf.next\server\edge-runtime-webpack.js:293:21)
at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/models/index.js:4:24)
at (rsc)/./node_modules/@pinecone-database/pinecone/dist/models/index.js (file://C:\Users\anura\OneDrive\Desktop\build\1.learningProduction\pdf.next\server\app\api\chat\route.js:1052:1)
at webpack_require (file://C:\Users\anura\OneDrive\Desktop\build\1.learningProduction\pdf.next\server\edge-runtime-webpack.js:37:33)
at fn (file://C:\Users\anura\OneDrive\Desktop\build\1.learningProduction\pdf.next\server\edge-runtime-webpack.js:293:21)
at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/inference/inference.js:40:16)
Im getting the same issue. Any update ?
Hi @anuragtej14 and @yeswanthkumar06 ! Thanks for flagging this.
TLDR: The most current version of our client does not run in Edge runtimes.
A known restriction of Edge runtimes is that they do not support many Node.js APIs and globals. Consequently, npm packages (such as our SDK) do not run on Edge runtimes due to Node.js dependencies. You can read more about that here: API Reference: Edge Runtime | Next.js.
We currently have a related, open issue that I am personally working on a fix for: [Bug] Pinecone client doesn't initialize on Cloudfare workers or Vercel · Issue #164 · pinecone-io/pinecone-ts-client · GitHub. You can find temporary workarounds in the comments.
We apologize for the inconvenience!
Looking forward to getting this solved with you!
Thanks @AudreyLorb.Pinecone the workaround seems to be working. Thanks.
Great, thanks for the update @yeswanthkumar06!
Will you share which specific workaround solved the problem for you?
Hey, all!
Just wanted to follow up here: we just shipped a fix for this issue (our client not working in Edge runtimes). Let us know if the issue(s) still exist after pulling down the newest code from main
. PR for your reference here: Remove Typebox and AVJ to work better with Edge runtimes by aulorbe · Pull Request #249 · pinecone-io/pinecone-ts-client · GitHub
thanks, @AudreyLorb.Pinecone
i am having the same issues
is the fix available in @pinecone-database/pinecone v 3.0.0 ?
cause I’m still getting the error when using ‘export const runtime = “edge”;’
@shedrackitulah apologies for the confusion – we have merged the fix to main
, but have not yet issued the patch release, which is how you would grab the new code with npm
(or another package mgmt tool).
We plan to release today (I am new to releasing – apologies!!). If you have the time, you’re welcome to clone the repo and use the code on main
, but I totally understand that dealing with source code is not ideal.
I will update this thread once we have issued the patch release.
Thanks, a lot
looking forward to the patch release
Hello, thanks for your patience here!
We’ve officially issued a patch
release: Release v3.0.1 · pinecone-io/pinecone-ts-client · GitHub. If you update your client to 3.0.1
, you should get the most recent code.
Please let us know if you still encounter problems.
If we don’t hear from this thread for ~1 week, we will assume the issue has been solved
I’m currently using 3.0.1 but still getting the same error
this is a simplified version of my route but I’m still getting the same error
import { Pinecone } from "@pinecone-database/pinecone";
export const runtime = "edge";
export async function POST(req: NextRequest) {
try {
const pc = new Pinecone({ apiKey: process.env.PINECONE_API_KEY! });
console.log("pc", pc);
return NextResponse.json("test");
} catch (error) {
throw new Error((error as Error).message);
}
}
Error [TypeError]: Cannot read properties of undefined (reading 'custom')
at <unknown> (webpack-internal:///(rsc)/./node_modules/.pnpm/@pinecone-database+pinecone@3.0.1/node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js:114)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@pinecone-database+pinecone@3.0.1/node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js:114:43)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@pinecone-database+pinecone@3.0.1/node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js:162:2)
at (rsc)/./node_modules/.pnpm/@pinecone-database+pinecone@3.0.1/node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js (file:///.../.next/server/app/api/chat/route.js:975:1)
at __webpack_require__ (file:///.../.next/server/edge-runtime-webpack.js:37:33)
at fn (file:///.../.next/server/edge-runtime-webpack.js:323:21)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@pinecone-database+pinecone@3.0.1/node_modules/@pinecone-database/pinecone/dist/models/index.js:4:24)
at (rsc)/./node_modules/.pnpm/@pinecone-database+pinecone@3.0.1/node_modules/@pinecone-database/pinecone/dist/models/index.js (file:///.../.next/server/app/api/chat/route.js:986:1)
at __webpack_require__ (file:///.../.next/server/edge-runtime-webpack.js:37:33)
at fn (file:///.../.next/server/edge-runtime-webpack.js:323:21)
at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@pinecone-database+pinecone@3.0.1/node_modules/@pinecone-database/pinecone/dist/inference/inference.js:40:16)
Thanks for the further detail.
Do you know why the langchain modules are underlined? I wonder if the issue is actually with langchain’s Pinecone integration…
And to confirm – can you tell me your stack? Are you running Next JS on Vercel?
Sorry for so many follow-ups in rapid succession – when I look into the node-modules/pinecone/dist/* files (i.e. the transpiled .js files), I see that each highlighted line in your stacktrace points to a line using require
.
As you can see in the NextJS documentation, require
is not supported: API Reference: Edge Runtime | Next.js.
Let me see if we can change how the Typescript files are transpiled into Javascript on our end. But for now, this seems to be a known limitation of running Edge runtimes in NextJS.
Ohh I see
Thanks for the updates really appreciate it
I’ll use the node runtime for now
Would you be updating the thread if this is possible?
Hey @shedrackitulah absolutely!
Hey @shedrackitulah I just pushed a patch
release to npm
: 3.0.2
, in which we removed a native Node utility function that we believe was the culprit of this issue. Can you confirm the fix works for you?
Hi, I’m getting a similar error. I was getting it previously, but I also just updated to 3.0.3 and I’m still getting it. Any ideas how to fix it? Thanks!
⨯ Error [TypeError]: Cannot read properties of undefined (reading ‘custom’)
at (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js:114)
at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js:114:43)
at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js:162:2)
at (rsc)/./node_modules/@pinecone-database/pinecone/dist/models/embeddingsList.js (file:///Users/andrewkisch/chatpdf-yt/chatpdf-yt/.next/server/app/api/chat/route.js:3494:1)
at webpack_require (file:///Users/andrewkisch/chatpdf-yt/chatpdf-yt/.next/server/edge-runtime-webpack.js:37:33)
at fn (file:///Users/andrewkisch/chatpdf-yt/chatpdf-yt/.next/server/edge-runtime-webpack.js:293:21)
at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/models/index.js:4:24)
at (rsc)/./node_modules/@pinecone-database/pinecone/dist/models/index.js (file:///Users/andrewkisch/chatpdf-yt/chatpdf-yt/.next/server/app/api/chat/route.js:3505:1)
at webpack_require (file:///Users/andrewkisch/chatpdf-yt/chatpdf-yt/.next/server/edge-runtime-webpack.js:37:33)
at fn (file:///Users/andrewkisch/chatpdf-yt/chatpdf-yt/.next/server/edge-runtime-webpack.js:293:21)
at eval (webpack-internal:///(rsc)/./node_modules/@pinecone-database/pinecone/dist/inference/inference.js:40:16)