MichalLytek / MichalLytek/typegraphql-prisma

"RangeError: Maximum call stack size exceeded" running server

Open
#246 8 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
TypeScript
Stars
918
Forks
130
PR merge metrics
No merged PRs in 30d

Description

**Describe the Bug**
We have a large schema with 80 models created by introspecting a SQL Server database.
The generate step works fine, but the server (a copy of the "Prototyping" example's server) exits with "RangeError: Maximum call statck size exceeded."

**To Reproduce**
Use this repo: https://github.com/cgodkin/typegraphql-prisma-problem
This is essentially https://github.com/MichalLytek/typegraphql-prisma/tree/main/examples/1-prototyping with updated dependencies and our schema. Then do this:
```
yarn
yarn generate
yarn start
```

**Expected Behavior**
What should happen is a database connection error since you won't have the database configured. Something like this:
```
yarn run v1.22.17
$ ts-node --transpile-only ./index.ts
PrismaClientInitializationError: Error creating a database connection. (Error creating a database connection.)
at d:\users\carl\typegraphql-prisma-problem\node_modules\@prisma\client\runtime\index.js:26873:22 {
clientVersion: '3.2.1',
errorCode: undefined
}
Done in 5.75s.
```
Instead, you will get `RangeError: Maximum call stack size exceeded`

**Logs**
```
yarn run v1.22.17
$ ts-node --transpile-only ./index.ts
d:\users\carl\typegraphql-prisma-problem\node_modules\typescript\lib\typescript.js:41955
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
^
RangeError: Maximum call stack size exceeded
at Object.createModuleResolutionCache (d:\users\carl\typegraphql-prisma-problem\node_modules\typescript\lib\typescript.js:41955:43)
at Object.createProgram (d:\users\carl\typegraphql-prisma-problem\node_modules\typescript\lib\typescript.js:113808:40)
at Object.transpileModule (d:\users\carl\typegraphql-prisma-problem\node_modules\typescript\lib\typescript.js:141719:26)
at d:\users\carl\typegraphql-prisma-problem\node_modules\ts-node\src\index.ts:1204:21
at Object.compile (d:\users\carl\typegraphql-prisma-problem\node_modules\ts-node\src\index.ts:1243:30)
at Module.m._compile (d:\users\carl\typegraphql-prisma-problem\node_modules\ts-node\src\index.ts:1370:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object.require.extensions. [as .ts] (d:\users\carl\typegraphql-prisma-problem\node_modules\ts-node\src\index.ts:1374:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
error Command failed with exit code 1.
```

**Environment (please complete the following information):**

- OS: [e.g. Windows 10 21H1]
- Node: v16.13.2
- `typegraphql-prisma` version [e.g. 0.11.1]: 0.18.4
- Prisma version [e.g. 2.18.0]: 3.8.0
- TypeScript version (e.g. 4.2.2): 4.4.4

**Additional Context**
This seems like #212 (closed as a dup, but happened during generate) and #202 (still open). We have tried various things suggested in the latter but nothing has helped. Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure in the linked typegraphql-prisma-problem repository with yarn, yarn generate, and yarn start, using index.ts as the server entry point. Trace the stack through ts-node and TypeScript's transpileModule; done means the server starts far enough to report the expected database connection error instead of a RangeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, node.js, typescript
Domain
backend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.