I have the same problem in server action from RSC passing Next14 to Next15. But previously I fixed it on Next14 using try/finally :
redirect
internally throws an error so it should be called outside oftry/catch
blocks.
Next 13.4 Error: NEXT_REDIRECT in API routes:
export default async function Page() { let redirectPath: string | null = null try { //Rest of the code redirectPath = `/dashboard` } catch (error) { //Rest of the code redirectPath = `/` } finally { //Clear resources if (redirectPath) redirect(redirectPath) } return <>{/*Rest of JSX*/}</> }
The only solution I can see is to return some typed error caught by all your server actions and pages to do the redirection on top level.