Closed
Description
I spent some time trying to figure out why a redirect from a server action wasn't working. What made this more difficult was the fact that it works just fine locally, but when I deploy it to AWS the redirect does not work if there's a leading slash.
Absolute URLs work just fine, and removing the leading slash makes it work.
I've reduced this down to literally just a redirect in the server action itself, and the issue seems consistent for me.
If you have a server action inside it with literally nothing more than:
import { redirect } from "next/navigation";
export const myServerAction = () => {
redirect("/dashboard");
}
This doesn't work when deployed, but does locally.
But if I do:
import { redirect } from "next/navigation";
export const myServerAction = () => {
redirect("dashboard");
}
It's working just fine.
I'm using SST 2.41.2
. All routes are based on the app dir. I'm on next 14.1.4
.
Metadata
Metadata
Assignees
Labels
No labels