You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think part of the mistake here is that there's two use server. Perhaps you don't need the use server inside GET and then fix the types in getAllPosts for it to consistently return Promise<T> because server functions always return them.
Getting rid of the second 'use server' in the 'src/lib/api.ts' seems to fix the issue. I'm not sure what I did wrong through. This is still a solid-start bug, right? I wouldn't expect an infinite loop when I incorrectly apply 'use server'.
I'm not sure what this means. As far as I can tell, the type already consistently returns Promise?
lib/api has a use server which means all exported functions are now server functions and all will return a Promise type, which in this case getAllPosts returns a Promise. This is why you are having an error about getAllPosts().map(...) is not a function because getAllPosts() returned a Promise.
Last comment was slightly wrong. In the repro above, yarn dev works. yarn build && npx serve ./.output/public loads the first time it's open, freezes, and then additional attempt to open localhost:3000 freeze before the static html is rendered.
Activity
lxsmnsyc commentedon Sep 29, 2024
I think part of the mistake here is that there's two
use server. Perhaps you don't need theuse serverinside GET and then fix the types ingetAllPostsfor it to consistently returnPromise<T>because server functions always return them.maxburs commentedon Oct 6, 2024
@lxsmnsyc Does this match what you suggested?
I still see the same error:
I'm not sure what this means. As far as I can tell, the type already consistently returns
Promise<T>?maxburs commentedon Oct 6, 2024
Getting rid of the second
'use server'in the'src/lib/api.ts'seems to fix the issue. I'm not sure what I did wrong through. This is still a solid-start bug, right? I wouldn't expect an infinite loop when I incorrectly apply'use server'.lxsmnsyc commentedon Oct 6, 2024
lib/apihas ause serverwhich means all exported functions are now server functions and all will return a Promise type, which in this casegetAllPostsreturns a Promise. This is why you are having an error aboutgetAllPosts().map(...) is not a functionbecausegetAllPosts()returned a Promise.maxburs commentedon Oct 6, 2024
I tried to create a more minimal repro, but, it fails to load for (as far as I can tell) a totally different issue: https://github.com/maxburs/solid-start-infinite-loop
yarn devnever loads at all (no error in cli)yarn buildsucceedsyarn build && npx serve ./.output/publicalso never loadsmaxburs commentedon Oct 7, 2024
Last comment was slightly wrong. In the repro above,
yarn devworks.yarn build && npx serve ./.output/publicloads the first time it's open, freezes, and then additional attempt to openlocalhost:3000freeze before the static html is rendered.brenelz commentedon Jul 16, 2026
Is this solved?
brenelz commentedon Jul 18, 2026
the prod freeze with prerendered server functions doesn't reproduce on the v2 beta (works statically hosted, with the config above)