Skip to content
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

Fix server actions #177

Merged
merged 1 commit into from
Jan 15, 2025
Merged

Fix server actions #177

merged 1 commit into from
Jan 15, 2025

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
Contributor

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