Heath
Heath•15mo ago

Typescript compile error on convex folder in convex-ai-chat template

Made an issue on the repo: https://github.com/get-convex/convex-ai-chat/issues/1 I know it's probaby a one line config change but I haven't figured it out, it's a vite app for the frontend and tsc is failing with:
convex/serve.ts:4:44 - error TS2307: Cannot find module 'openai/resources' or its corresponding type declarations.
convex/serve.ts:4:44 - error TS2307: Cannot find module 'openai/resources' or its corresponding type declarations.
Do I have to update tsconfig in the root to know about the tsconfig in /convex or something?
GitHub
Typescript compile issue · Issue #1 · get-convex/convex-ai-chat
Thanks for sharing this template, it's great! I'm having some trouble getting it to build using npm run build - it's related to being able to find the openai/resources import in serve.t...
5 Replies
ballingt
ballingt•15mo ago
I see this too! I poked around and made https://github.com/get-convex/convex-ai-chat/pull/3 to get it to build. I haven't checked that this runs. In this particular case I'm guessing it's a bug in the openai types but it's also evidence that it's time to start using a more modern module resolution strategy in the default convex/tsconfig.json.
GitHub
Fix typescript build errors, but perhaps with implications by tho...
I haven't tried to run this yet, just making the PR as a reminder to investigate
Heath
HeathOP•15mo ago
Thank Tom! That builds and runs in dev, tbd if I can get it to deploy 🤞. Thanks for looking at this. Anyway you could share a bit about how you knew to make that change? (the Node --> Bundler index.mjs include - I get the others) Also I think alot of the components (maybe shadcn-ui components) in components/ui are not used FYI I deployed, updated with some docs, and made the embeddings and it seems to querying properly! The path I'm not testing though is ingesting URLs, the docs i'm indexing are local so I'm just using that updateDocument action.
ballingt
ballingt•15mo ago
@Heath turns out that change wasn't necessary, see Michal's fix above
Heath
HeathOP•15mo ago
Great, thanks for the help!

Did you find this page helpful?