Closed
Description
I'm using React Router as a...
framework
Reproduction
- Check out this file.
- Go to the
dashboard
folder. - Stand up the environment using
docker compose
and the instructions inREADME.md
(docker compose up
andnpm run dev
with some environment variables set) - select a function in the form at http://localhost:5173/optimization/fine-tuning.
- see the error in server logs
System Info
System:
OS: macOS 14.3
CPU: (16) arm64 Apple M3 Max
Memory: 265.94 MB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.4.0 - /opt/homebrew/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.9.2 - /opt/homebrew/bin/npm
Browsers:
Chrome: 131.0.6778.205
Safari: 17.3
npmPackages:
@react-router/dev: ^7.0.2 => 7.1.0
@react-router/node: ^7.0.2 => 7.1.0
@react-router/serve: ^7.0.2 => 7.1.0
react-router: ^7.1.0 => 7.1.0
vite: ^5.4.11 => 5.4.11
Used Package Manager
npm
Expected Behavior
I expected the route to work and return the object to the caller -- this lets me use the following snippet to ensure type safety:
const response = await fetch(`/api/curated_inferences/count?${params}`);
const { loaderData } =
(await response.json()) as CuratedInferencesCount.ComponentProps;
setCounts(loaderData as CountsData);
Actual Behavior
I get the following server error:
The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose
Error: Expected a Response to be returned from resource route handler
at invariant3 (file:///Users/viraj/tensorzero/tensorzero/dashboard/node_modules/react-router/dist/development/chunk-W3HZJLUQ.mjs:8537:11)
at handleResourceRequest (file:///Users/viraj/tensorzero/tensorzero/dashboard/node_modules/react-router/dist/development/chunk-W3HZJLUQ.mjs:9273:5)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at requestHandler (file:///Users/viraj/tensorzero/tensorzero/dashboard/node_modules/react-router/dist/development/chunk-W3HZJLUQ.mjs:9059:18)
at nodeHandler (/Users/viraj/tensorzero/tensorzero/dashboard/node_modules/@react-router/dev/dist/vite.js:1980:30)
at /Users/viraj/tensorzero/tensorzero/dashboard/node_modules/@react-router/dev/dist/vite.js:1986:17