-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when server function throws redirect and wrapped in createAsync #429
Comments
From what I can tell this is already being thrown as a normal error and not a crash - wrapping the |
I think the issue here is that instead of handling the redirect, and navigating user to the new url, it throws an error. I don't think wrapping From the docs it seems that only |
Yeah |
Just flagging here that I stumbled upon this problem as well. It'd be useful to have another more neutral way of sending redirects. I was fetching some session data from the server and if it's not present I wanted to redirect to the sign in page. I ended up wrapping the function in an action but had to go through all the |
Describe the bug
If you throw a redirect from a server function wrapped in createAsync it does not handle the redirect nor serialize it across. Server functions called as actions might want to throw redirects, and if used elsewhere it is likely they would as well.
cache
wrapping handles the redirect, but if you do not want caching, you do not have anoCache
option and therefore throw or return a redirect causing what? currently a crash.Example:
results in exception:
Error: Unknown error at castError (...server bundle...)
and client shows:
Your Example Website or App
see above
Steps to Reproduce the Bug or Issue
createAsync
Expected behavior
The redirect happens or thrown as error, but not a serialization crash
Screenshots or Videos
No response
Platform
any
Additional context
No response
The text was updated successfully, but these errors were encountered: