zod-to-json-schema: Maximum call stack size exceeded in zodToJsonSchema
I am writing a backend API in Nextjs14
const topicSchema = z.object({
topics: z
.array(
z.object({
topic: z.string().describe("The topic of the position")
})
)
.describe("An array of topics"),
});
const res = zodToJsonSchema(topicSchema)
this code return Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
at Module.zodToJsonSchema (webpack-internal:///(rsc)/./node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
at Module.zodToJsonSchema (webpack-internal:///(rsc)/./node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
at Module.zodToJsonSchema (webpack-internal:///(rsc)/./node_modules/zod-to-json-schema/dist/esm/index.js:43:107)
...
I am using zod-to-json-schema with NextJS 14, langchain ^0.0.177
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Reactions: 2
- Comments: 15 (7 by maintainers)
Jesus christ
I have re-produced the same issue. I have made a project in Stackblitz please take a look at it.
https://stackblitz.com/edit/stackblitz-starters-foddlw?description=The%20React%20framework%20for%20production&file=app%2Fapi%2Ftest%2Froute.ts&title=Next.js%20Starter
Steps npm install && npx next dev Visit : <Output window domian>/api/test
You can see the logs