Skip to content

Incompatibility Between Request and getServerSession in Next.js 14 API Routes #7

@biisal

Description

@biisal

In Next.js 14, API routes use the Request object from the Web API, which provides a json() method for parsing request bodies. However, when integrating NextAuth's getServerSession in these API routes, there is an inconsistency because getServerSession requires NextApiRequest and NextApiResponse objects, which are specific to Next.js's traditional API routes.

This causes a conflict when trying to access session details using getServerSession in the new API routes. Developers are forced to either switch back to NextApiRequest and NextApiResponse, losing the benefits of the modern Web API Request, or find a workaround, which complicates the development process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions