Closed AndreMaz closed 2 months ago
Did a quick test by adding an if
like so:
if (!String.prototype.format) {
Object.defineProperty(String.prototype, "format", {});
}
and it solves the issue
I will do some patch for this package, thanks for feedback
any idea of what's going on here? My knowledge about this lib is pretty limited.
We are using this package to keep same logic with python side, so
I'm developing a next based app and after updating llamaindex to v0.5.21 I started to see the following error:
Initially I assumed that the error was caused by https://github.com/run-llama/LlamaIndexTS/pull/1154 (hence my comments in there)
In my attempt to isolate the problem I've checked out to latest commit that was working (lllamaindex v0.5.16) and then started bumping llamaindex step-by-step in my
pnpm-workspace.yaml
that looks like:Results: v0.5.16 - OK v0.5.17 - OK v0.5.18 - OK v0.5.19 - OK v0.5.20 - OK v0.5.21 - Error starts here v0.5.22 - - Error continues here
Rolling back to v0.5.20 the error disappears. This leads me be to believe that the culprit is some commit between 0.5.20 and 0.5.21
Here are the changes in
pnpm-lock.yaml
The error comes from this file
apps/web/.next/server/vendor-chunks/@llamaindex.js
More context about how this error happens: I'm using
llamaindex
atapp/api/chat/route.ts
, in other words, I'm using Route HandlersWhen I start my app and open
/home
next.js compiles the app and I can call llamaindex atapp/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 atapp/api/chat/route.ts
I get the error above.I'm assuming that during the first compilation the
Object.defineProperty(String.prototype, "format", {/* logic */})
gets executed without any issue. However, during the second compilation if throws theCannot redefine property: format
error@marcusschiesser @himself65 any idea of what's going on here? My knowledge about this lib is pretty limited.