update code snippet in nextjs server-side auth guide step 7 #26281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have read the [CONTRIBUTING.md] (https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file.
YES
What kind of change does this PR introduce?
This is an update to the code snippet under Step 7 in the [NextJS server-side auth guide docs] (https://supabase.com/docs/guides/auth/server-side/nextjs?queryGroups=router&router=app).
What is the current behavior?
When deployed via docker (e.g. on GCP Cloud Run), the current example code snippet redirects users upon clicking a "confirm email address link" to the port exposed by the docker container, instead of the root of the deployed application or the specified redirect URL.
E.g. If the app is deployed on https://example.app via GCP Cloud Run with a docker container exposing the app on localhost:3000, when user clicks on https://example.app/auth/confirm?token_hash=pkce_09802jk2349h434239iy849h4&type=signup they will be redirected to localhost:3000/ instead of https://example.app/
What is the new behavior?
The new example code snippet uses redirect() from next/navigation and redirects to the global root of the deployed app, or the specified redirect URL.
Additional context
Detailed description with code snippets and logs in this GitHub issue.