cannot read properties of undefined (reading 'client')
I used the solid js cli to setup my solidstart project with trpc option but i am getting this error
TypeError: Cannot read properties of undefined (reading 'client')
at Object.get (C:/Users/USER/Documents/code/schoolmanager/node_modules/.pnpm/vinxi@0.5.8_db0@0.3.2_iored_9954f56ba07c8a3e53c0173fd9b9b83a/node_modules/vinxi/lib/manifest/prod-server-manifest.js:46:53)
at createPageEvent (C:/Users/USER/Documents/code/schoolmanager/node_modules/.pnpm/@solidjs+start@1.2.0_solid-_a90b4d0317bcc58d5bc34a4af43825d1/node_modules/@solidjs/start/dist/server/pageEvent.js:30:45)
at eval (C:/Users/USER/Documents/code/schoolmanager/node_modules/.pnpm/@solidjs+start@1.2.0_solid-_a90b4d0317bcc58d5bc34a4af43825d1/node_modules/@solidjs/start/dist/server/handler.js:43:31)
at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
at provideRequestEvent (file:///C:/Users/USER/Documents/code/schoolmanager/node_modules/.pnpm/solid-js@1.9.9/node_modules/solid-js/web/storage/dist/storage.js:7:14)
at handler (C:/Users/USER/Documents/code/schoolmanager/node_modules/.pnpm/@solidjs+start@1.2.0_solid-_a90b4d0317bcc58d5bc34a4af43825d1/node_modules/@solidjs/start/dist/server/handler.js:24:59)
at _callHandler (file:///C:/Users/USER/Documents/code/schoolmanager/node_modules/.pnpm/h3@1.15.3/node_modules/h3/dist/index.mjs:1862:22)
at _handler (file:///C:/Users/USER/Documents/code/schoolmanager/node_modules/.pnpm/h3@1.15.3/node_modules/h3/dist/index.mjs:1843:12)
2 Replies
the error occurs because the server side code is typing to access the trpc client before it's initialized. in the current setup, the client was only configured for the browser, I've updated the server and client initialization so the trpc client is available in both environments. after clearing the cache and rebuiliding, this should resolve the issue
@Jose Rizal do you have an example repo where the change was made.