Skip to content

Expose types to the frontend for Next.js #3252

@itstheandre

Description

@itstheandre

Bug description

I am playing around with prisma and getting that async_hooks error and its a rather weird thing. Let me explain:
If i have this:

import { prisma } from "../utils/prismaClient";

import { startingForm } from "../utils/startingForm";

Nothing breaks. here, prisma is jsut a new PrismaClient(). Nothing else. In this application I am just using prisma for the getStaticProps of Next.js

However, if I add a index.js to the utils folder and just do:

import { prisma, startingForm } from '../utils"

I get the error again. Is there a reason for this?

You can take a look at the repo here:

https://github.com/itstheandre/build-cv-messing-around

Not a lot of code written. Just a little small thing I was messing around to build a resume and the async_hooks issue came up again. Now I know I am not using prisma on the frontend per se. I am only using it in the api of Next.js.
Any idea of what might be happening?

How to reproduce

Expected behavior

Prisma information

Prisma Schema

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

model Experience {
  id          Int     @default(autoincrement()) @id
  name        String
  company     String?
  personal    Boolean @default(false)
  from        String?
  to          String?
  description String
  website     String?

}

Prisma Query -> Literally the only query I am doing

const experiences = await prisma.experience.findMany({})

Environment & setup

- OS: Mac OS
- Database: PostgreSQL
- Node.js version: 12.16.3
- Prisma version:  2.4.1

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions