vercel / next.js

The React Framework
https://nextjs.org
MIT License
124.82k stars 26.64k forks source link

get(...) is not a function #21043

Closed cheesequest closed 3 years ago

cheesequest commented 3 years ago

What version of Next.js are you using?

9.5.5

What version of Node.js are you using?

14.15.3

What browser are you using?

CryptoTab

What operating system are you using?

Windows

How are you deploying your application?

npm run dev

Describe the Bug

When trying to use Prisma as a function, it tells me get(...) isn't a function.

import Head from "next/head";
import { PrismaClient } from '@prisma/client';
import Nav from '../components/Nav'

const prisma = new PrismaClient();

export async function getServerSideProps({ params }) {
  const users = await prisma.user.findMany({
    where: {
      name: params.toString()
    }
  })

  return {
    props: { users }
  }
}

export default function UserPage({ users }) {
  return (
    <>
      <Head>
        <title>{users.name}</title>
      </Head>
      <Nav />
      <div key={users.id}>
        <h1>{users.name}</h1>
        <p>{users.bio}</p>
      </div>
    </>
  )
}

Error from NextJS on the browser:

./pages/[...username].tsx
TypeError: E:\libby\libby-web\pages\[...username].tsx: get(...) is not a function

Expected Behavior

I expected the username endpoint to load with data.

To Reproduce

timneutkens commented 3 years ago

Please add a complete reproduction to this issue.

cheesequest commented 3 years ago

Please add a complete reproduction to this issue.

I'm not entirely sure what you'd like me to add?

timneutkens commented 3 years ago

Closing as I checked with the Prisma team and they said it's related to a library you're using (superjson) which is unrelated to Next.js

balazsorban44 commented 2 years ago

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.