mozzius
mozzius17mo 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
Nick17mo 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
mozzius17mo 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
Nick17mo 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
mozzius17mo 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
Nick17mo ago
Make sure you pull the latest main. There might have been an issue when you tried it which is now fixed
mozzius
mozzius17mo 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