Skip to content

Fix server actions#177

Merged
PaulAsjes merged 1 commit intomainfrom
fix/server-actions-broken
Jan 15, 2025
Merged

Fix server actions#177
PaulAsjes merged 1 commit intomainfrom
fix/server-actions-broken

Conversation

@PaulAsjes
Copy link
Contributor

Fixes #175

We previously were copying headers from the request via new Headers(request.headers) which it turns out mangles the required headers for server actions.

This cleans up some types and makes sure we don't mess with the headers.

See this issue for more details.

@PaulAsjes PaulAsjes requested a review from nicknisi January 15, 2025 11:29
@PaulAsjes PaulAsjes merged commit ec6fdec into main Jan 15, 2025
4 checks passed
@PaulAsjes PaulAsjes deleted the fix/server-actions-broken branch January 15, 2025 14:31
@moroshko
Copy link

@PaulAsjes I'm curious why the return type of withAuth when ensureSignedIn is true was modified to include null?

v1.0.1

const { user } = await withAuth({ ensureSignedIn: true });
// user is User

v1.0.2

const { user } = await withAuth({ ensureSignedIn: true });
// user is User | null

@nicknisi
Copy link
Member

I think this part should be able to be reversed since Next will throw an error to redirect if the user isn't signed in, when ensureSignedIn is true. Addressed in #185.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

useAuth always returns null user

3 participants

Comments