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

[SDK-3556] Prevent mixing named exports and own instances #825

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

adamjmcgrath
Copy link
Contributor

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

Mixing named exports and a self created instance can lead to confusing errors, when this happens we will now throw an error to inform the developer.

import { initAuth0, getSession } from '@auth0/nextjs-auth0';

const instance = initAuth0();

export default instance.withApiAuthRequired(req, res) {
  const session = await getSession(req, res);
  // 💥 Errors because they should be using `instance.getSession`
}

📎 References

See #429 #526 #725

@adamjmcgrath adamjmcgrath added the review:medium Medium review label Sep 20, 2022
@adamjmcgrath adamjmcgrath requested a review from a team as a code owner September 20, 2022 13:59
@vercel
Copy link

vercel bot commented Sep 20, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
nextjs-auth0 ⬜️ Ignored (Inspect) Sep 20, 2022 at 1:59PM (UTC)

@adamjmcgrath adamjmcgrath changed the title Prevent mixing named exports and own instances [SDK-3556] Prevent mixing named exports and own instances Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:medium Medium review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants