Need help debugging this error: Client-only API called on the server side. Run client-only code in
My solid start project works fine in dev mode, but when I try to do
vinxi build
followed by vinxi start
I get the below error:
I tried addressing the problem by wrapping browser specific API calls with onMount and Show, but I have had no luck so far. My main issue is this error does not tell me which is the offending file and I end up playing the guessing game. Please guide me about how do I resolve this.
OS: macOS 15.2
Node: 23.5.0
"@solidjs/start": "^1.0.10",
"solid-js": "^1.9.2",
"vinxi": "^0.5.1"
What have I tried so far?
- Tried running vinxi in debug mode. Probably not doing it right.
- From the above trace: - .output/server/node_modules/solid-js/web/dist/server.js: 1136:9 this is most likely framework code.
.output/server/chunks/nitro/nitro.mjs:7177:17797 : minified server code too8 Replies
Do you have a file with toplevel "use server"
Which exports a
query
?Do you mean https://docs.solidjs.com/solid-router/reference/data-apis/query#query? All my query calls are part of client side components.
Currently only 2 files use
use server
which are talking to pocketbase using pocketbase sdk and the client side components are calling these files either directly or via REST endpoont (middleware)There might be a better way, but one way is to divide and conquer: don't import most code, add files/components one at a time
Yes.. I'm gonna try that later tonight. Shall update here.
It is such a pain 😦
Maybe try with vinxi 0.4.3
The latest templates are on this version
https://github.com/solidjs/solid-start/blob/main/examples/basic/package.json
GitHub
solid-start/examples/basic/package.json at main · solidjs/solid-start
SolidStart, the Solid app framework. Contribute to solidjs/solid-start development by creating an account on GitHub.
Yes ... just reverted to vinxi 0.4.3 and it works now!!!!
Is this an issue with the latest vinxi version? Should I raisee this as a bug in vinxi?
There are known issues regarding vite 6
The plan is to wait for the new nitro version which will replace vinxi.