Open GheorgheMocanu opened 1 year ago
if you found a solution, let me know
@Elliott-Chong
What steps did I take? At first I followed the video and learned how you showed me, but I got to this problem at 2:30:00. I thought it was a problem on my part or maybe I didn't write something correctly in the code, then: I downloaded the project from github I replaced the keys in .env But I get the same error In S3 bucket, the files are loaded, but in pinecone nothing is sent
maybe the problem is because of pinecone
maybe the problem is because of pinecone
for you its work ?
no I have the same issue as you
Hi @AymanBoumait and @GheorgheMocanu ,
The error coming 2 things:
chatpf
on Pinecone dashboardIn my case, because of my Open AI token. I didn't setup payment methods on OpenAI, so my token is not available to use. So I get the same error like you guys.
The error come from line const vectors = await Promise.all(documents.flat().map(embedDocument))
(image attached).
I'm having the same issue. getting held up ~2:30.
I started throwing a type error following the video on loadS3IntoPinecone() relating to namespace
. In diagnosing I noticed changes made to the libraries imported from Pinecone for pinecone.ts. I've reviewed and tried to make necessary changes, but am now receiving the same errors described here.
Hi @AymanBoumait and @GheorgheMocanu ,
The error coming 2 things:
- Pinecone: You need to create index
chatpf
on Pinecone dashboard- Open AI API Token
In my case, because of my Open AI token. I didn't setup payment methods on OpenAI, so my token is not available to use. So I get the same error like you guys. The error come from line
const vectors = await Promise.all(documents.flat().map(embedDocument))
(image attached).
Hmmmm, I tried to follow the steps you mentioned.
" const pineconeIndex = await client.index("chatpdf"); " it have same name like in pinecone dashboard
but that didn't solve the problem, I get exactly the same error
Same here, is there anyone found a solution?
meow {file_key: 'uploads/1699375092777C23-81-Performans Analizi Kriterleri R01.pdf', file_name: 'C23-81 Performans Analizi Kriterleri R01.pdf'} xhr.js:251
POST http://localhost:3000/api/create-chat 500 (Internal Server Error)
dispatchXhrRequest @ xhr.js:251 xhr @ xhr.js:49 dispatchRequest @ dispatchRequest.js:51 request @ Axios.js:146 httpMethod @ Axios.js:185 wrap @ bind.js:5 mutationFn @ FileUpload.tsx:24 fn @ mutation.mjs:87 run @ retryer.mjs:101 createRetryer @ retryer.mjs:149 executeMutation @ mutation.mjs:81 execute @ mutation.mjs:138 await in execute (async) mutate @ mutationObserver.mjs:85 eval @ useMutation.mjs:19 onDrop @ FileUpload.tsx:51 await in onDrop (async) eval @ index.js:708 eval @ index.js:759 Promise.then (async) eval @ index.js:758 eval @ index.js:831 eval @ index.js:192 eval @ index.js:190 callCallback @ react-dom.development.js:19467 invokeGuardedCallbackImpl @ react-dom.development.js:19516 invokeGuardedCallback @ react-dom.development.js:19591 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:19605 executeDispatch @ react-dom.development.js:30661 processDispatchQueueItemsInOrder @ react-dom.development.js:30693 processDispatchQueue @ react-dom.development.js:30706 dispatchEventsForPlugins @ react-dom.development.js:30717 eval @ react-dom.development.js:30907 batchedUpdates$1 @ react-dom.development.js:23771 batchedUpdates @ react-dom.development.js:27623 dispatchEventForPluginEventSystem @ react-dom.development.js:30906 dispatchEvent @ react-dom.development.js:28679 dispatchDiscreteEvent @ react-dom.development.js:28650 app-index.js:31 AxiosError {message: 'Request failed with status code 500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', config: {…}, request: XMLHttpRequest, …} window.console.error @ app-index.js:31 console.error @ hydration-error-info.js:45 execute @ mutation.mjs:158 await in execute (async) mutate @ mutationObserver.mjs:85 eval @ useMutation.mjs:19 onDrop @ FileUpload.tsx:51 await in onDrop (async) eval @ index.js:708 eval @ index.js:759 Promise.then (async) eval @ index.js:758 eval @ index.js:831 eval @ index.js:192 eval @ index.js:190 callCallback @ react-dom.development.js:19467 invokeGuardedCallbackImpl @ react-dom.development.js:19516 invokeGuardedCallback @ react-dom.development.js:19591 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:19605 executeDispatch @ react-dom.development.js:30661 processDispatchQueueItemsInOrder @ react-dom.development.js:30693 processDispatchQueue @ react-dom.development.js:30706 dispatchEventsForPlugins @ react-dom.development.js:30717 eval @ react-dom.development.js:30907 batchedUpdates$1 @ react-dom.development.js:23771 batchedUpdates @ react-dom.development.js:27623 dispatchEventForPluginEventSystem @ react-dom.development.js:30906 dispatchEvent @ react-dom.development.js:28679 dispatchDiscreteEvent @ react-dom.development.js:28650 app-index.js:31 AxiosError {message: 'Request failed with status code 500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', config: {…}, request: XMLHttpRequest, …} window.console.error @ app-index.js:31 console.error @ hydration-error-info.js:45 onError @ FileUpload.tsx:58 eval @ mutationObserver.mjs:113 batch @ notifyManager.mjs:20 notify @ mutationObserver.mjs:102 onMutationUpdate @ mutationObserver.mjs:59 eval @ mutation.mjs:236 eval @ mutation.mjs:235 batch @ notifyManager.mjs:20 dispatch @ mutation.mjs:234 execute @ mutation.mjs:167 await in execute (async) mutate @ mutationObserver.mjs:85 eval @ useMutation.mjs:19 onDrop @ FileUpload.tsx:51 await in onDrop (async) eval @ index.js:708 eval @ index.js:759 Promise.then (async) eval @ index.js:758 eval @ index.js:831 eval @ index.js:192 eval @ index.js:190 callCallback @ react-dom.development.js:19467 invokeGuardedCallbackImpl @ react-dom.development.js:19516 invokeGuardedCallback @ react-dom.development.js:19591 invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:19605 executeDispatch @ react-dom.development.js:30661 processDispatchQueueItemsInOrder @ react-dom.development.js:30693 processDispatchQueue @ react-dom.development.js:30706 dispatchEventsForPlugins @ react-dom.development.js:30717 eval @ react-dom.development.js:30907 batchedUpdates$1 @ react-dom.development.js:23771 batchedUpdates @ react-dom.development.js:27623 dispatchEventForPluginEventSystem @ react-dom.development.js:30906 dispatchEvent @ react-dom.development.js:28679 dispatchDiscreteEvent @ react-dom.development.js:28650
i am also getting same axios error is anybody solve this issue. @ybekocak @GheorgheMocanu @AymanBoumait @0xalphaprime @huynextlevel
Same I'm getting that same error , any resolutions ?
Had the same issue.
It might be that you are out of credits. You can try to check result.data in the embeddings.ts file like this:
import {OpenAIApi, Configuration} from 'openai-edge'
const config = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(config);
export async function getEmbeddings(text: string) {
try{
const response = await openai.createEmbedding({
model: "text-embedding-ada-002",
input: text.replace(/\n/g, " "),
});
const result = await response.json();
console.log('API response:', result); // Debug log
console.log('Embeddings:', result.data[0].embedding); // Debug log
return result.data[0].embedding as number[];
}catch(error){
console.log('error calling openai embeddings api', error);
throw error;
}
}
Hey guys i have found a simple solution for this.. While i was debugging this Axios error: internal server error 500 : IF you notice your concole in code editor there might be written file/module not found error. Solution: When you are trying to upload a File....
I have this problem, dont know actually how to solved, learning by your video. if somebody can help me please?
this is my terminal:
⚠ ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/load-crt.js Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
Import trace for requested module: ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/load-crt.js ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/SignatureV4MultiRegion.js ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.shared.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js ./node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js ./node_modules/@aws-sdk/client-s3/dist-cjs/index.js ./src/lib/s3.ts ./src/components/FileUpload.tsx
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js Module not found: Can't resolve 'aws-crt' in '/Users/goga/Documents/myProjects/chatpdf/node_modules/@aws-sdk/util-user-agent-node/dist-cjs'
Import trace for requested module: ./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js ./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js ./node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js ./node_modules/@aws-sdk/client-s3/dist-cjs/index.js ./src/lib/s3.ts ./src/components/FileUpload.tsx ⚠ ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/load-crt.js Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
Import trace for requested module: ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/load-crt.js ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/SignatureV4MultiRegion.js ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.shared.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js ./node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js ./node_modules/@aws-sdk/client-s3/dist-cjs/index.js ./src/lib/s3.ts ./src/components/FileUpload.tsx
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js Module not found: Can't resolve 'aws-crt' in '/Users/goga/Documents/myProjects/chatpdf/node_modules/@aws-sdk/util-user-agent-node/dist-cjs'
Import trace for requested module: ./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js ./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js ./node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js ./node_modules/@aws-sdk/client-s3/dist-cjs/index.js ./src/lib/s3.ts ./src/components/FileUpload.tsx ⚠ ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/load-crt.js Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
Import trace for requested module: ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/load-crt.js ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/SignatureV4MultiRegion.js ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.shared.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js ./node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js ./node_modules/@aws-sdk/client-s3/dist-cjs/index.js ./src/lib/s3.ts ./src/components/FileUpload.tsx
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js Module not found: Can't resolve 'aws-crt' in '/Users/goga/Documents/myProjects/chatpdf/node_modules/@aws-sdk/util-user-agent-node/dist-cjs'
Import trace for requested module: ./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js ./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js ./node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js ./node_modules/@aws-sdk/client-s3/dist-cjs/index.js ./src/lib/s3.ts ./src/components/FileUpload.tsx ⚠ ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/load-crt.js Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
Import trace for requested module: ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/load-crt.js ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/SignatureV4MultiRegion.js ./node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.shared.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js ./node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js ./node_modules/@aws-sdk/client-s3/dist-cjs/index.js ./src/lib/s3.ts ./src/components/FileUpload.tsx
./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js Module not found: Can't resolve 'aws-crt' in '/Users/goga/Documents/myProjects/chatpdf/node_modules/@aws-sdk/util-user-agent-node/dist-cjs'
Import trace for requested module: ./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js ./node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js ./node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js ./node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js ./node_modules/@aws-sdk/client-s3/dist-cjs/index.js ./src/lib/s3.ts ./src/components/FileUpload.tsx
./node_modules/node-fetch/lib/index.js Module not found: Can't resolve 'encoding' in '/Users/goga/Documents/myProjects/chatpdf/node_modules/node-fetch/lib'
Import trace for requested module: ./node_modules/node-fetch/lib/index.js ./node_modules/cross-fetch/dist/node-ponyfill.js ./node_modules/@pinecone-database/pinecone/dist/pinecone.js ./node_modules/@pinecone-database/pinecone/dist/index.js ./src/lib/pincecone.ts ./src/app/api/create-chat/route.ts uploads/1695248226308the-weekend.pdf the weekend.pdf downloading s3 into file system loading pdf into memory/tmp/elliott1695248229781.pdf error calling openai embeddings api TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 2) at async loadS3IntoPinecone (webpack-internal:///(rsc)/./src/lib/pincecone.ts:41:21) at async POST (webpack-internal:///(rsc)/./src/app/api/create-chat/route.ts:31:9) at async /Users/goga/Documents/myProjects/chatpdf/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:66877 error embedding document TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 2) at async loadS3IntoPinecone (webpack-internal:///(rsc)/./src/lib/pincecone.ts:41:21) at async POST (webpack-internal:///(rsc)/./src/app/api/create-chat/route.ts:31:9) at async /Users/goga/Documents/myProjects/chatpdf/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:66877 TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 2) at async loadS3IntoPinecone (webpack-internal:///(rsc)/./src/lib/pincecone.ts:41:21) at async POST (webpack-internal:///(rsc)/./src/app/api/create-chat/route.ts:31:9) at async /Users/goga/Documents/myProjects/chatpdf/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:66877 error calling openai embeddings api TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 3) error embedding document TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 3) error calling openai embeddings api TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 4) error embedding document TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 4) error calling openai embeddings api TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 1) error embedding document TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 1) error calling openai embeddings api TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 0) error embedding document TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 0) error calling openai embeddings api TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 5) error embedding document TypeError: Cannot read properties of undefined (reading '0') at getEmbeddings (webpack-internal:///(rsc)/./src/lib/embeddings.ts:18:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async embedDocument (webpack-internal:///(rsc)/./src/lib/pincecone.ts:52:28) at async Promise.all (index 5)