-
Notifications
You must be signed in to change notification settings - Fork 397
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
Support edge runtime in app based routes #1257
Comments
Hi @gerlv
You can use the edge based eg. import { getSession } from '@auth0/nextjs-auth0/edge';
import { NextRequest, NextResponse } from 'next/server';
const GET = async (req: NextRequest) => {
const res = new NextResponse();
const session = await getSession(req, res);
return NextResponse.json(session?.user, res);
};
export { GET }; |
@adamjmcgrath thank you for a code snippet, I can see it works, but as far as I can see this wouldn't work with app based routes, and you can't override I.e. there is a way to get the session, but the large part of the functionality can't be used with edge runtime. |
Can you elaborate? The code snippet I shared works with app based routes (on the edge runtime) in the new beta, have tested it on the example app
We are currently working on supporting the rest of the functionality on the Edge runtime, should be landing in the new v3 Beta very soon |
Just to clarify, does this mean support for |
@ekojsalim - yes, that's correct. We have a branch which adds support for all the functionality from the Node runtime to the Edge runtime (in the app directory) here https://github.com/auth0/nextjs-auth0/tree/edge-auth-handlers It's code complete and ready to be shipped to the new Beta, we just have an issue with Next.js - which we have an open PR for here vercel/next.js#51665 |
That's awesome. Was actually assessing whether to fork & patch but having this supported is great. Looking forward to v3 :) |
👋 Full support for the edge runtime, including More info on the Beta can be found here #1235 |
Checklist
Describe the problem you'd like to have solved
NextJS Auth0 can work with edge runtime.
At the moment, only the middleware supports the edge runtime. You can't use edge based getSession in app routes.
Describe the ideal solution
Edge runtime supported for app based routes
Alternatives and current workarounds
Use nodejs runtime
Additional context
No response
The text was updated successfully, but these errors were encountered: