StackSays
Menu

Vector Database · troubleshooter

Pinecone: 'PineconeClient is not a constructor' (Node.js)

Direct answer

This is a Pinecone SDK version break, not a bug in your code. PineconeClient was deprecated in v1 and later removed; the current @pinecone-database/pinecone exports only the Pinecone class. Replace `new PineconeClient()` + `await client.init({...})` with `new Pinecone({ apiKey })`. Note v2 also changed the upsert/namespace call shape.

Symptom

  • ·TypeError: PineconeClient is not a constructor
  • ·Error appears after an npm install / SDK upgrade
  • ·Old init() / upsert examples stop working

Cause (official)

  • ·v1.0.0 introduced the Pinecone class and deprecated PineconeClient (also dropping the async init())
  • ·later versions removed PineconeClient entirely
  • ·v2.0.0 further changed upsert() and namespace handling

Fix — decide and apply

  • ·Preferred: migrate to the current SDK — `import { Pinecone } from '@pinecone-database/pinecone'` then `const pc = new Pinecone({ apiKey })`; drop the old init() call.
  • ·Update index/upsert calls to the v2 signatures (see the official migration guide).
  • ·Only if you can't migrate now: pin the old SDK major version to unblock, and schedule the upgrade.

How to verify

  • ·Check the installed version in package-lock/pnpm-lock
  • ·Confirm the import uses Pinecone, not PineconeClient
  • ·Run a small upsert against a test index

Based on Pinecone's official migration guide — confirm against the exact SDK version in your lockfile.

FAQ

Do I have to migrate, or can I keep the old Pinecone client?

You can pin the old major version to unblock temporarily, but PineconeClient is removed in current releases — migrating to the Pinecone class is the supported path.

Official sources

Next decision