prisma: prisma@4.7.1 - "RangeError: Maximum call stack size exceeded" when clientExtensions enabled
Bug description
Enabling clientExtensions feature causes TypeScript failure.
RangeError: Maximum call stack size exceeded
at getResolvedMembersOrExportsOfSymbol (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:48886:53)
at getMembersOfSymbol (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:48932:19)
at isEmptyAnonymousObjectType (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:54984:60)
at Object.some (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:663:25)
at getNormalizedUnionOrIntersectionType (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:55142:44)
at getNormalizedType (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:55128:48)
at isRelatedTo (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:55440:30)
at typeRelatedToEachType (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:55751:35)
at unionOrIntersectionRelatedTo (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:55687:28)
at structuredTypeRelatedToWorker (/Users/joe/Library/pnpm/global/5/.pnpm/typescript@4.9.3/node_modules/typescript/lib/tsc.js:56024:34)
How to reproduce
Please see notes on reproduction repository README: https://github.com/JoeKarow/prisma4.7.1-reproduce
Expected behavior
No response
Prisma information
Prisma schema: https://github.com/JoeKarow/prisma4.7.1-reproduce/blob/main/prisma/schema.prisma
Environment & setup
- OS: macOS 13.0.1 Intel
- Database: PostgreSQL
- Node.js version: 16.18.1
Prisma Version
Environment variables loaded from .env
prisma : 4.7.1
@prisma/client : 4.7.1
Current platform : darwin
Query Engine (Node-API) : libquery-engine 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/.pnpm/@prisma+engines@4.7.1/node_modules/@prisma/engines/libquery_engine-darwin.dylib.node)
Migration Engine : migration-engine-cli 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/.pnpm/@prisma+engines@4.7.1/node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/.pnpm/@prisma+engines@4.7.1/node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt 272861e07ab64f234d3ffc4094e32bd61775599c (at node_modules/.pnpm/@prisma+engines@4.7.1/node_modules/@prisma/engines/prisma-fmt-darwin)
Format Wasm : @prisma/prisma-fmt-wasm 4.7.1-1.272861e07ab64f234d3ffc4094e32bd61775599c
Default Engines Hash : 272861e07ab64f234d3ffc4094e32bd61775599c
Studio : 0.477.0
Preview Features : multiSchema, filteredRelationCount, fieldReference, postgresqlExtensions, clientExtensions
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 18
- Comments: 29 (8 by maintainers)
Commits related to this issue
- prisma error fixed - related to prisma/prisma#16600 — committed to weareinreach/InReach by JoeKarow 2 years ago
- prisma error fixed - related to prisma/prisma#16600 — committed to weareinreach/InReach by JoeKarow 2 years ago
Same issue hear without even using
$extendsjust upgrading to 4.8.0 crashes our compilation.Confirmed this still exists in 4.8.0.
$extendsclient method triggers this, as doesPrisma.defineExtension.Hey @lipis @mattbajorek, sorry that you’re still experiencing this. We’ve fixed and tested the original reproduction case, but it seems there is more to it. Could you please provide us with a reproduction?
Update: Nevermind, I could reproduce it with a more complex schema
I installed the 4.8.0 and still have the issue when building a Next.js app with
$extendsI’m having this same error too. For me it only happens when I actually try to use an extension not just enabling it.
export const DBConn = new PrismaClient({ log: [ { emit: 'event', level: 'query', }, { emit: 'stdout', level: 'error', }, { emit: 'stdout', level: 'info', }, { emit: 'stdout', level: 'warn', }, ], }).$extends({ name: 'user display name', result: { users: { displayName: { needs: { first_name: true, preferred_name: true }, compute(user) { return user.preferred_name || user.first_name; }, }, }, }, });If I remove the .$extension part, everything works just fine. Starting it with ts-node.
[nodemon] watching extensions: ts,json [nodemon] startingts-node ./src/api.ts/Users/ajholloway/programming/nectarbackend/node_modules/typescript/lib/typescript.js:66937 outofbandVarianceMarkerHandler = function (onlyUnreliable) { ^ RangeError: Maximum call stack size exceeded at outofbandVarianceMarkerHandler (/Users/ajholloway/programming/nectarbackend/node_modules/typescript/lib/typescript.js:66937:63)Done! https://github.com/prisma/prisma/issues/17349 . Let me know if you need any additional information.
Thanks to your help
4.9.0-integration-feat-client-ext-generic-type-api.13, should fix the export issue as well as the node inference issue @khalil-omer. Could you please give it a try? I am not 100% for you @Multiply since I was not able to reproduce this exact same error. If the issue persists, would you mind sending me your schema? As for the nested includes issue, I will fix it but treat it as a separate issue.Many thanks for the help so far 👍
@millsp this latest error appears to be related to
declarations: trueanddeclerationMaps: true. If I set both properties tofalsein the tsconfig, the error disappears and the build is successful.As someone commented here, there is an outstanding bug with declarations. Maybe there should be a separate issue created for that.
Hey @beeman, I think we’ve had another report of this here.
@millsp Hi - looks like you are making progress with this. With your branch installed, the call stack error is gone and
Prisma.defineExtensionthrows no tsc errors. However,$extendsis now throwing the following error instead.Exported variable 'pivotPrisma' has or is using name 'Payload' from external module "[path]/client/runtime/index" but cannot be named.The above error is actually throwing many times. Not sure if that fact helps you debug.
@millsp in case you still need my use case… here is what I did with
$extendin my Next.js project: https://gist.github.com/lipis/7564e99b6315a3940dbcb1a5c1a413a9That’s my schema 😄