New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error PineconeConnectionError #464
Comments
Hey @uteitler, great to see you back here tackling new challenges! 🚀 Based on the context provided, the The issue arises because the To resolve this issue, consider exporting a function that initializes the Pinecone client on-demand and ensures that it is properly awaited before use. This approach allows for better error handling and ensures that the client is fully initialized before any operations are attempted. Here's how you can modify your code: import { Pinecone } from '@pinecone-database/pinecone';
if (!process.env.PINECONE_ENVIRONMENT || !process.env.PINECONE_API_KEY) {
throw new Error('Pinecone environment or api key vars missing');
}
async function initPinecone() {
try {
const pinecone = new Pinecone({
environment: process.env.PINECONE_ENVIRONMENT ?? '',
apiKey: process.env.PINECONE_API_KEY ?? '',
});
// You might want to add any initialization logic here, e.g., verifying the connection
return pinecone;
} catch (error) {
console.log('error', error);
throw new Error('Failed to initialize Pinecone Client');
}
}
// Export the init function instead of the client instance
export const getPineconeClient = initPinecone; With this change, you would use import { getPineconeClient } from './utils/pinecone-client';
async function someFunction() {
const pinecone = await getPineconeClient();
// Use the pinecone client for your operations here
} This ensures that the Pinecone client is initialized and ready before any operations are performed, reducing the likelihood of connection errors due to initialization issues. You can refer to the utils/pinecone-client.ts file for more details. Regarding the I hope this helps! If you have any further questions or if the issue persists, please provide more details so I can assist you better. Sources
|
I finally managed to injest (serverless does not work),
I run "npm run dev" and the GUI spins up in local host
as soon as I type something in I get this error.
The env is obviously OK as the injest worked ok .. any ideas?
error PineconeConnectionError: Request failed to reach Pinecone. Verify you have the correct environment, project id, and index name configured.
at C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:52:39
at step (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:33:23)
at Object.next (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:14:53)
at C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:8:71
at new Promise ()
at __awaiter (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:4:12)
at handleFetchError (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:47:67)
at C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:62:71
at step (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:33:23)
at Object.next (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:14:53)
at C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:8:71
at new Promise ()
at __awaiter (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:4:12)
at handleApiError (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\errors\handling.js:59:59)
at QueryCommand. (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\data\query.js:94:74)
at step (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\data\query.js:44:23)
at Object.throw (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\data\query.js:25:53)
at rejected (C:\Users\User\Documents\GitHub\gpt4pdf\node_modules@pinecone-database\pinecone\dist\data\query.js:17:65)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
The text was updated successfully, but these errors were encountered: