solid-query breaks in Astro SSR
Author: lachlancollinsCreated Sep 25, 2026Updated Sep 25, 2026
Describe the bug
When trying to test out the solid-query Astro example, I noticed the server crashed on initial page load with the following error:
file:///home/.../query/node_modules/.pnpm/[email protected]/node_modules/solid-js/dist/server.js:540
const resolved = options.ssrLoadFrom !== "initial" && sharedConfig.context.async && "data" in sharedConfig.context.resources[id];
^
TypeError: Cannot use 'in' operator to search for 'data' in undefined
at prepareResource (file:///home/.../query/node_modules/.pnpm/[email protected]/node_modules/solid-js/dist/server.js:540:96)
at loading (file:///home/.../query/node_modules/.pnpm/[email protected]/node_modules/solid-js/dist/server.js:555:5)
at read.get (file:///home/.../query/node_modules/.pnpm/[email protected]/node_modules/solid-js/dist/server.js:569:16)
at Array.eval (/home/.../query/packages/solid-query/build/dev.js:280:55)
at cleanNode (file:///home/.../query/node_modules/.pnpm/[email protected]/node_modules/solid-js/dist/server.js:132:68)
at cleanNode (file:///home/.../query/node_modules/.pnpm/[email protected]/node_modules/solid-js/dist/server.js:128:49)
... collapsed 7 duplicate lines matching above 1 lines 7 times...
at Timeout._onTimeout (file:///home/.../query/node_modules/.pnpm/[email protected]/node_modules/solid-js/dist/server.js:54:52)
at listOnTimeout (node:internal/timers:605:17)
at process.processTimers (node:internal/timers:541:7)After some digging around, the issue seems to be related to createResource, and specifically the prepareResource function. The resource.loading property calls this prepareResource() function, while some other properties do not. I will share a PR which seems to solve this issue shortly.
Your minimal, reproducible example
https://tanstack.com/query/latest/docs/framework/solid/examples/astro
Steps to reproduce
- Open the example in StackBlitz or Codesandbox
- See the console error
Expected behavior
Should successfully load the query on the server.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: Linux
- Browser: Firefox
- Version: solid-query 5.103.2
Tanstack Query adapter
solid-query
TanStack Query version
v5.103.2
TypeScript version
No response
Additional context
No response
Source: TanStack/query