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: double-wrapped return values caused by Promise.{reject,resolve} #1861

Closed
wants to merge 1 commit into from

Conversation

kripod
Copy link
Contributor

@kripod kripod commented Apr 26, 2021

Reasoning 💡

Both Promise.reject and Promise.resolve return a Promise on their own. They are meant to be called inside non-async functions and serve as an escape hatch when native async/await syntax isn’t available.

The code of NextAuth is transpiled, though, so all the async functions already return a Promise by default. Thus, Promise.reject and Promise.resolve aren’t necessary anymore, and they may cause issues like #602.

Checklist 🧢

Feel free cross items ( like this ~[] item~ ) if they're irrelevant to your changes.

To check an item, place an x in the box like so: - [x] Documentation.

  • [ ] Documentation
  • [ ] Tests
  • Ready to be merged

Affected issues 🎟

Possibly fixes #602

@vercel
Copy link

vercel bot commented Apr 26, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nextauthjs/next-auth/9zoCDr8N8Tv7EE7qugCghnoYEVRY
✅ Preview: https://next-auth-git-fork-kripod-no-double-wrapped-promises-nextauthjs.vercel.app

@vercel vercel bot temporarily deployed to Preview April 26, 2021 14:53 Inactive
@github-actions github-actions bot added adapters Changes related to the core code concerning database adapters core Refers to `@auth/core` providers test Related to testing labels Apr 26, 2021
@balazsorban44
Copy link
Member

I encourage you to open this against the adapters repository, so our migration process can be quicker.

You can read https://github.com/nextauthjs/adapters/issues/37#issuecomment-826413849 for our plans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters core Refers to `@auth/core` providers test Related to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UnhandledPromiseRejectionWarning within prisma adapter
2 participants