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:
npm run start

> NODE_ENV=development DEBUG=vinxi:* vinxi start


[6:09:20 am] ERROR Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.

at notSup (.output/server/node_modules/solid-js/web/dist/server.js:1136:9)
at .output/server/chunks/nitro/nitro.mjs:7177:17797
at ModuleJob.run (node:internal/modules/esm/module_job:272:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:552:26)
at async Object.run (node_modules/vinxi/bin/cli.mjs:278:7)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)



[6:09:20 am] ERROR Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.
npm run start

> NODE_ENV=development DEBUG=vinxi:* vinxi start


[6:09:20 am] ERROR Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.

at notSup (.output/server/node_modules/solid-js/web/dist/server.js:1136:9)
at .output/server/chunks/nitro/nitro.mjs:7177:17797
at ModuleJob.run (node:internal/modules/esm/module_job:272:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:552:26)
at async Object.run (node_modules/vinxi/bin/cli.mjs:278:7)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)



[6:09:20 am] ERROR Client-only API called on the server side. Run client-only code in onMount, or conditionally run client-only component with <Show>.
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 too
8 Replies
Madaxen86
Madaxen864w ago
Do you have a file with toplevel "use server" Which exports a query?
batman✅
batman✅OP4w ago
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)
Erik Demaine
Erik Demaine4w ago
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
batman✅
batman✅OP4w ago
Yes.. I'm gonna try that later tonight. Shall update here. It is such a pain 😦
Madaxen86
Madaxen864w ago
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.
batman✅
batman✅OP4w ago
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?
Madaxen86
Madaxen864w ago
There are known issues regarding vite 6 The plan is to wait for the new nitro version which will replace vinxi.

Did you find this page helpful?