LlamaIndexTS: Error: Unknown node type: DOCUMENT
@himself65 bumped to 0.5.24 to see If the https://github.com/run-llama/LlamaIndexTS/issues/1176 is fixed. It is but now I’m getting the following error:
Error: Unknown node type: DOCUMENT at splitNodesByType (webpack-internal:///(rsc)/…/…/node_modules/@llamaindex/core/dist/schema/index.js:708:19) at createMessageContent (webpack-internal:///(rsc)/…/…/node_modules/llamaindex/dist/synthesizers/utils.js:11:94) at DefaultContextGenerator.generate (webpack-internal:///(rsc)/…/…/node_modules/llamaindex/dist/engines/chat/DefaultContextGenerator.js:50:107) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ContextChatEngine.prepareRequestMessages (webpack-internal:///(rsc)/…/…/node_modules/llamaindex/dist/engines/chat/ContextChatEngine.js:470:25) at async ContextChatEngine.chat (webpack-internal:///(rsc)/…/…/node_modules/llamaindex/dist/engines/chat/ContextChatEngine.js:437:33) at async Object.start (webpack-internal:///(rsc)/./src/app/api/chat/route.ts:60:32)
Note: This error was not present in the v0.5.20. Something that I initially described in https://github.com/run-llama/LlamaIndexTS/issues/1172
I can repro the issue exactly in the same way as I’ve mentioned in the ticket above. From the ticket:
I’m using llamaindex at app/api/chat/route.ts , in other words, I’m using Route Handlers When I start my app and open /home next.js compiles the app and I can call llamaindex at app/api/chat/route.ts without any error. Then, when I navigate to another page (e.g, /products) next.js does another compilation. After this when I call the handler at app/api/chat/route.ts I get the error above.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (14 by maintainers)
@himself65 after googling around and checking the issue that you’ve linked in https://github.com/run-llama/LlamaIndexTS/pull/1214
What’s the chance of some change after 0.5.20 (last one that was working without complaining) caused CJS and ESM bundling as described in this article https://www.codejam.info/2024/02/esm-cjs-dupe.html ?
@himself65 here are the versions that I’m currently using
Here’s my
next.config.mjsAll
llamaindex-related code is located inapp/api/chatconfig.ts
verctor-store.tsroute.ts