mozzius
mozzius2y ago

middleware error with minimal-react example

hello! I tried to use the minimal-react version, but I get an error - it says that 'middleware' does not exist on CreateHTTPHandlerOptions<...>. Am I doing something wrong or is it broken?
6 Replies
Nick
Nick2y ago
You may need to upgrade your tRPC version, that feature was released quite recently We're doing quite frequent releases without breaking changes so you should be safe to just update to the latest 10.x version
mozzius
mozziusOP2y ago
Yeah sorry wasn’t clear - I was trying to use the minimal-react example from the repo (aka I cloned the whole monorepo and tried to run the example) So it’s definitely v10 :)
Nick
Nick2y ago
Got it, yes I would hope that’s on the latest version! 😝 Starting fine on my machine, make sure you do
pnpm install
pnpm build

cd examples/minimal-react
pnpm dev
pnpm install
pnpm build

cd examples/minimal-react
pnpm dev
(though I reserve the right for those first 2 steps to not be necessary)
mozzius
mozziusOP2y ago
Yep works all fine on my work laptop, will have to wait until I get home to try again properly It was super strange though. Wasn’t saying cors wasn’t installed or anything, just refusing to believe that middleware was an option you could pass
Nick
Nick2y ago
Make sure you pull the latest main. There might have been an issue when you tried it which is now fixed
mozzius
mozziusOP2y ago
Got it working - not 100% sure what is was but I synced my fork and ran pnpm build and it's working. I think the issue might have been not running the build command in the root dir