Hi all, I have been running Prisma 2.19.0 for a wh...
# orm-help
m
Hi all, I have been running Prisma 2.19.0 for a while now without issue. And I just migrated from Prisma 2.19.0 -> 2.24.1 but now when I run:
Copy code
$> npx prisma generate
Everything runs fine, but all the prior references in my code to any Models I had before are broken/missing. When I look in
node_modules/.pnpm/@prisma/client@2.24.1_prisma@2.24.1/node_modules/@prisma/client/index.d.ts
it's empty except for this one line:
Copy code
export * from '.prisma/client'
To upgrade the dependency I ran:
Copy code
$> pnpm up prisma
$> pnpm up @prisma/client
j
The actual client code should be in
.prisma/client
as it says.
m
Thank you for the reply. Before in 2.19 it had my models, how would then import my models in my project? I was doing this before:
Copy code
import { MyModelName } from '@prisma/client'
But those links are broken - how would I do this now with version
2.24.1
?
j
Exactly the same way, that is what the code you mentioned does.
In 2.19 the actual client should already have been in anotehr file, forever really
m
Understood, but after the upgrade everything breaks for me.
j
If you think the models are not being generated, look into
node_modules/.prisma/client/index.d.ts
probably
m
I did and I have this:
Copy code
/**
 * ##  Prisma Client ʲˢ
 *
 * Type-safe database client for TypeScript & Node.js (ORM replacement)
 * @example
 *
* const prisma = new Prisma() * // Fetch zero or more Users * const users = await prisma.user.findMany() *
Copy code
*
 *
 * Read more in our [docs](<https://github.com/prisma/prisma/blob/master/docs/prisma-client-js/api.md>).
 */
export declare const PrismaClient: any
/**
 * ##  Prisma Client ʲˢ
 *
 * Type-safe database client for TypeScript & Node.js (ORM replacement)
 * @example
 *
* const prisma = new Prisma() * // Fetch zero or more Users * const users = await prisma.user.findMany() *
Copy code
*
 *
 * Read more in our [docs](<https://github.com/prisma/prisma/blob/master/docs/prisma-client-js/api.md>).
 */
export declare type PrismaClient = any

export declare const dmmf: any
export declare type dmmf = any

/**
 * Get the type of the value, that the Promise holds.
 */
export declare type PromiseType<
  T extends PromiseLike<any>
> = T extends PromiseLike<infer U> ? U : T

/**
 * Get the return type of a function which returns a Promise.
 */
export declare type PromiseReturnType<
  T extends (...args: any) => Promise<any>
> = PromiseType<ReturnType<T>>
Sry so verbose - but none of my models are there.
j
Yep that looks just like the stub
Did you follow the release notes between these versions?
Does
npx prisma -v
confirm the update worked?
m
Yes I tried that and it's 2.24.1 I'll look at release notes between them, I did check those but not intensely
Copy code
➜  api git:(MyGitBranch) ✗ npx prisma -v
Environment variables loaded from .env
prisma               : 2.24.1
@prisma/client       : 2.24.1
Current platform     : darwin
Query Engine         : query-engine 18095475d5ee64536e2f93995e48ad800737a9e4 (at ../../node_modules/.pnpm/@prisma/engines@2.24.1-2.18095475d5ee64536e2f93995e48ad800737a9e4/node_modules/@prisma/engines/query-engine-darwin)
Migration Engine     : migration-engine-cli 18095475d5ee64536e2f93995e48ad800737a9e4 (at ../../node_modules/.pnpm/@prisma/engines@2.24.1-2.18095475d5ee64536e2f93995e48ad800737a9e4/node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 18095475d5ee64536e2f93995e48ad800737a9e4 (at ../../node_modules/.pnpm/@prisma/engines@2.24.1-2.18095475d5ee64536e2f93995e48ad800737a9e4/node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary        : prisma-fmt 18095475d5ee64536e2f93995e48ad800737a9e4 (at ../../node_modules/.pnpm/@prisma/engines@2.24.1-2.18095475d5ee64536e2f93995e48ad800737a9e4/node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : 18095475d5ee64536e2f93995e48ad800737a9e4
Studio               : 0.397.0
It's a multi project
I just looked through everything - if I am mistaken there are no steps I would need to follow for all release notes from 2.19 -> 2.24.1 (except for removing some previewFeatures and updating code to handle aggregate changes).
j
So
npx prisma generate
makes your project to go from working to not working any more?
m
Exactly
All the models I had in import statements are missing. And no error is produced with
npx prisma generate
Copy code
➜  api git:(MyGitBranch) ✗ npx prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (2.24.1) to ./node_modules/@prisma/client in 160ms
You can now start using Prisma Client in your code. Reference: <https://pris.ly/d/client>
import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient()```
j
That is pretty weird as it generates an empty client, which would usually throw an error message
something about paths is werid probably
Can you try 2.23 instead?
m
OH WAIT
Btw yes I can try
Okay real quick - I have a dir structure for this project that's like this (and it's
pnpm
) :
Copy code
MyMainProj
   -> apps
      --> api
And I noticed the models are exported to
MyMainProj->apps->api->node_modules
But my app looks in
MyMainProj->apps->node_modules
Again though before with 2.19 this seemed to work fine, but for 2.24.1 it does not. I could go down the chain of
minor
patch releases to see when this functionality breaks for me.
j
I am pretty sure it is 2.24.0
If you can confirm it still works with 2.23.0 I have a very good hunch what is going on
m
You're right - it is 2.24 - 2.23 did work.
j
And it would be awesome if you could create an issue about this then, and maybe even create a minimal reproduction.
m
So I'm learning a bit more here btw - I can give you my output of
npx generate prisma
Sure - would this be in GitHub?
j
Yes, prisma/prisma
👍 1
m
Btw for reference here is the output of
23.0
and
24.1
respectively:
Copy code
➜  api git:(MyGitBranch) ✗ npx prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (2.23.0) to ./../../node_modules/.pnpm/@prisma/client@2.23.0_prisma@2.23.0/node_modules/@prisma/client in 640ms
You can now start using Prisma Client in your code. Reference: <https://pris.ly/d/client>
import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient()
Copy code
```
and:
```➜  api git:(MyGitBranch) ✗ npx prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (2.24.1) to ./node_modules/@prisma/client in 185ms
You can now start using Prisma Client in your code. Reference: <https://pris.ly/d/client>
import { PrismaClient } from '@prisma/client' const prisma = new PrismaClient() ``````
j
but both are different enough that an additional issue would be useful
m
You can see it's not writing to
../../node_modules
in
24.1
Okay thank you for clarifying - I thought they might be similar enough - will do
👍 1
j
We changed something about path resolution, and seems that projects with pnpm are not happy with that change 😕
m
Okay thank you
j
Saw the issue, thanks.