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

UnhandledPromiseRejectionWarning within prisma adapter #602

Closed
2 of 5 tasks
nickisnoble opened this issue Aug 24, 2020 · 5 comments
Closed
2 of 5 tasks

UnhandledPromiseRejectionWarning within prisma adapter #602

nickisnoble opened this issue Aug 24, 2020 · 5 comments
Labels
question Ask how to do something or how something works stale Did not receive any activity for 60 days

Comments

@nickisnoble
Copy link
Contributor

nickisnoble commented Aug 24, 2020

I can't seem to fix this error! Can you help?

What are you trying to do
I'm trying to set up just the basic email/passwordless login.

Relevant stack:

Everything right now is extremely default and working, except when I try to submit an email login. It hangs forever, giving the following in the server:

(node:58840) UnhandledPromiseRejectionWarning: Error:
Invalid `prisma.user.findOne()` invocation in
/path/to/project/node_modules/next-auth/dist/adapters/prisma/index.js:125:33


  Invalid feature flag: aggregations
    at PrismaClientFetcher.request (/path/to/project/node_modules/@prisma/client/runtime/index.js:1:211356)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:58840) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:58840) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

If I cancel the request (hit the X in the browser) it adds:

Error! Failed to complete request to /api/auth/signin/email: Error: socket hang up

// pages/api/auth/[...next-auth].js

import NextAuth from 'next-auth';
import Providers from 'next-auth/providers';
import Adapters from 'next-auth/adapters';
import { PrismaClient } from '@prisma/client';

// I've tried with and without this, as per the docs
let prisma;
if (process.env.NODE_ENV === "production") {
  prisma = new PrismaClient();
} else {
  if (!global.prisma) {
    global.prisma = new PrismaClient();
  }
  prisma = global.prisma;
}

const options = {
    providers: [
        Providers.Email({
            server: process.env.EMAIL_SERVER,
            from: process.env.EMAIL_FROM,
        }),
    ],

    adapter: Adapters.Prisma.Adapter({ prisma }),
}

export default (req, res) => NextAuth(req, res, options)

Feedback

  • Found the documentation helpful
  • Found documentation but was incomplete
  • Could not find relevant documentation
  • Found the example project helpful
  • Did not find the example project helpful
@nickisnoble nickisnoble added the question Ask how to do something or how something works label Aug 24, 2020
@SharadKumar
Copy link

@nickisnoble your issues seems to be related to Prisma. Ensure you running the latest.
Hint: https://community.redwoodjs.com/t/redwoodjs-v0-13-0-has-been-released/874

@LoriKarikari
Copy link
Contributor

@nickisnoble were you able to fix this?

@stale
Copy link

stale bot commented Dec 5, 2020

Hi there! It looks like this issue hasn't had any activity for a while. It will be closed if no further activity occurs. If you think your issue is still relevant, feel free to comment on it to keep ot open. Thanks!

@stale stale bot added the wontfix This will not be worked on label Dec 5, 2020
@balazsorban44 balazsorban44 added stale Did not receive any activity for 60 days and removed wontfix This will not be worked on labels Dec 5, 2020
@stale
Copy link

stale bot commented Dec 12, 2020

Hi there! It looks like this issue hasn't had any activity for a while. To keep things tidy, I am going to close this issue for now. If you think your issue is still relevant, just leave a comment and I will reopen it. (Read more at #912) Thanks!

@stale stale bot closed this as completed Dec 12, 2020
@greynguyen
Copy link

@nickisnoble Did you manage to fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Ask how to do something or how something works stale Did not receive any activity for 60 days
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants