#Cannot read properties of undefined (reading 'unstable_middleware')

1 messages · Page 1 of 1 (latest)

carmine geyser
#

I've just got round to hosting a production build of my app, and running into this issue when I try to host on Netlify. It builds completely fine and works without issue locally, but seeing the following error when I access the deployed site.

I used the Netlify template and, unfortunately, a fresh clone of that deploys perfectly fine so I must've broken something on my end.

One thing I can think of is I had to upgrade @mjackson/node-fetch-server to 0.6.1 in order to fix an issue with form submissions.

Any help would be huuuugely appreciated, thank you so much 🙏

carmine geyser
#

Ok I seem to have fixed it by adding the unstable_middleware stuff in react-router.config.ts...even though it works fine locally without?

import type { Config } from "@react-router/dev/config";

export default {
      // Config options...
      // Server-side render by default, to enable SPA mode set this to `false`
      ssr: true,
+     future: {
+       unstable_middleware: true,
+     },
} satisfies Config;

+ declare module "react-router" {
+  interface Future {
+    unstable_middleware: true;
+ }
}
carmine geyser
#

Never mind. I removed those changes—putting everything back to how it was when it was broken—and it still works. idk why 🤷‍♂️