docs(nextjs): point the sample, JSDoc and quick start at the middleware entry point - #552
Open
DonOmalVindula wants to merge 1 commit into
Open
Conversation
…re entry point asgardeoMiddleware and createRouteMatcher moved to the Edge-safe `@asgardeo/nextjs/middleware` entry point when the token refresh was added to the middleware, but the bundled sample still imported them from `@asgardeo/nextjs/server` (which no longer exports them), the JSDoc examples imported them from the package root, and the quick start described a `new AsgardeoNext()` / `asgardeo.middleware()` setup that never existed. - Fix the imports in samples/teamspace-nextjs and the JSDoc examples. - Rewrite the quick start's middleware step and the embedded login step (the sign-in page path is configured through NEXT_PUBLIC_ASGARDEO_SIGN_IN_URL, which both the provider and the middleware read); drop the stray Auth.js references. - Document the middleware entry point in the README. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 53 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🦋 Changeset detectedThe changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
asgardeoMiddlewareandcreateRouteMatchermoved to the Edge-safe@asgardeo/nextjs/middlewareentry point in d6b5cba (token refresh in the middleware), but nothing that points users at the middleware followed:samples/teamspace-nextjs/middleware.tsstill imports them from@asgardeo/nextjs/server, which no longer exports them, so the sample does not build. CI's E2E suite only runs the React sample, so this went unnoticed.asgardeoMiddlewareimport from the package root, which never exported it.QUICKSTART.mddescribes anew AsgardeoNext()/asgardeo.middleware(request)setup that does not exist (the constructor is private and there is nomiddleware()method), and configures the embedded sign-in page path through that non-existent API.Fix
@asgardeo/nextjs/middleware.asgardeoMiddleware()from the middleware entry point; the embedded login step configures the sign-in page throughNEXT_PUBLIC_ASGARDEO_SIGN_IN_URL, which both the provider and the middleware read (SignInButtonnavigates there,protectRoute()redirects there). The stray "Auth.js" references in the intro and resources are dropped.middleware.ts.Re-exporting the middleware from
/serverfor backward compatibility was deliberately not done: that entry pulls@asgardeo/node(and its Node-only dependencies) into the Edge bundle, which is what the separate entry point avoids.Testing
pnpm lintfor@asgardeo/nextjs; the./middlewareexport condition anddist/types/middleware.d.tsare present in the build.Changeset included (
@asgardeo/nextjspatch).🤖 Generated with Claude Code