TypeError when importing any command or Client
Hey. When I import either of these 2 classes, I get this error.
TypeError: Cannot read properties of undefined (reading 'Base')
This is the contents of handler.ts:
Solution:Jump to solution
I must've been doing something wrong the first, time turbopack appears to fix it now
15 Replies
What is the full stack trace? And what runtime and bundler are you using?
I'm trying to make a bot builder using Carbon. This is my interactions endpoint, and where it errors upon import.
Base definitely does exist, BaseInteraction pulls it from index.js where it does exist there too
Yeah, that’s what’s weird about it. I’ve tried reinstalling the package to no avail.
It's more related to webpack/next. Base is defined, Module isn't which is what webpack seems to be star importing carbon as. Tho I have no idea why or how to solve this, Evaluate is run on Next to so it is possible to do. What version of next.js are you using? Are you using turbopack?
Next.js 14.2.11. I am not using turbopack.
I'm currently experimenting to see where exactly it's erroring. I don't think it's at import anymore. I've gotten it to import in an API route.
Okay. It seems to appear when I initialize the Client.
I can't access the base class by itself either.
I created a post in the Next support server.
I'm having this same issue in a bare bones repo, nextjs 14.2.11 without turbopack
Level Up!
Congratulations <@439223656200273932>, you leveled up to level 2!
Switching to turbopack seems to resolve it though (@Apteryx @Asleep)
It also looks like webpack in production works fine, its just dev mode
I can try that again.
GitHub
GitHub - thewilloftheshadow/carbon-nextjs-test
Contribute to thewilloftheshadow/carbon-nextjs-test development by creating an account on GitHub.
I have time, gonna try again
Solution
I must've been doing something wrong the first, time turbopack appears to fix it now
issue fixed ✅