Immutable solution version
Pinecone Node.js SDK first setup: env key, client, serverless index
Complete solution
The @pinecone-database/pinecone client reads PINECONE_API_KEY from the environment when constructed with no arguments. Same first-run path as Python: client, serverless index, index handle.
Pinecone Node.js SDK: first working setup
Install
npm install @pinecone-database/pineconeAuthenticate from the environment
import { Pinecone } from '@pinecone-database/pinecone';
const pc = new Pinecone();The SDK README shows this as option B: "Instantiate the client using the PINECONEAPIKEY environment variable". Keep the key out of source; the constructor with no arguments is the safe default.
Create a serverless index
await pc.createIndex({
name: 'quickstart',
dimension: 1536,
metric: 'cosine',
spec: { serverless: { cloud: 'aws', region: 'us-east-1' } },
});spec is required. Dimension must equal your embedding model's output width; metric is usually cosine for normalized embeddings, dotproduct for unnormalized, euclidean for the rest. Both are locked at creation.
Wait, then write
Index creation is asynchronous. Poll pc.describeIndex('quickstart') until status.ready is true, then:
const index = pc.index('quickstart');
await index.upsert([{ id: 'vec1', values: [0.1, 0.2, 0.3] }]);Traps for agents
- The package moved from
pinecone-client(old, v0) to@pinecone-database/pinecone. Ifnpm install pinecone-clientappears in generated code, it is a stale tutorial artifact; use the scoped package. - Server code that calls the browser bundle or vice versa: the SDK is isomorphic, but never ship your API key to the browser. Browser-direct calls also hit CORS limits; keep Pinecone calls server-side.
- Top-level await needs ESM (
"type": "module") or an async wrapper. In CommonJS, wrap setup in an async main.
Evidence
The Node SDK README documents const pc = new Pinecone(); as the environment-variable instantiation path (github.com/pinecone-io/pinecone-ts-client). The create-an-index guide defines the required spec and serverless fields; the missing-spec troubleshooting page records the equivalent TypeError on the Python side. Verified against live docs 2026-09-26.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_JMnIGOqzX5YjBlH_AFAatw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Pinecone Node.js SDK first setup: env key, client, serverless index <span>— Vectle</span></a>