Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive stack depth error following upgrade to v6.0 #1209

Open
blecorre-mnp opened this issue Feb 24, 2025 · 6 comments
Open

Excessive stack depth error following upgrade to v6.0 #1209

blecorre-mnp opened this issue Feb 24, 2025 · 6 comments
Labels
bug upstream:edgedb Issue produced by changes to EdgeDB/EdgeQL

Comments

@blecorre-mnp
Copy link

blecorre-mnp commented Feb 24, 2025

Describe the bug
When switching to Gel 6.0 and using the latest @gel/generate version, we get multiple Excessive stack depth comparing types ... errors as a result of tsc.

Reproduction
Following the initialization of a new project, simply try to generate the query builder with npx @gel/generate edgeql-js --target=ts and opening the generated file casting.ts is enough to see the error on our side. Here is the result of the tsc command.

Errors  Files
     5  dbschema/edgeql-js/casting.ts:53
    16  dbschema/edgeql-js/modules/std.ts:1859
     5  dbschema/edgeql-js/operators.ts:933
     2  dbschema/edgeql-js/set.ts:150

Expected behavior
It should not return any error, as things used to work fine when using older EdgeDB / Gel versions such as v5.8.

Versions

  • OS: MacOS Sequoia 15.3.1
  • EdgeDB version: 6.0+a940583
  • EdgeDB CLI version: 6.1.2+1e45048
  • @gel/generate version: 0.6.0
  • Node/Deno version: 22.10.0
@scotttrinh
Copy link
Collaborator

Can you share what version of TypeScript you're using here? Seems to work fine for me on a relatively complex schema with TypeScript v5.7.3 but we're always teetering on the verge on complexity so maybe there is a regressive case in a different (earlier? beta?) version of TypeScript?

@blecorre-mnp
Copy link
Author

Unfortunately, we are also currently running on TypeScript v5.7.3 as well..

$ npx tsc --version
Version 5.7.3

@blecorre-mnp
Copy link
Author

@scotttrinh so you have something to try the issue on, I threw together this new basic Gel project with our current production schema. I was wrong in my comment above, it only breaks when the schema reaches a certain complexity. Let's hope we can find a solution!

@scotttrinh
Copy link
Collaborator

OK, that is incredibly helpful, thanks for getting a repro together! I'll try to grab some time this week to dig in a bit and see if there is some specific construct that is triggering this issue. In the meantime, you might try targeting a non-ts output style like esm and see if it works without the more complicated internal constructs that the full ts target uses? Thanks again for the thorough report!

@scotttrinh scotttrinh added bug upstream:edgedb Issue produced by changes to EdgeDB/EdgeQL labels Feb 24, 2025
@blecorre-mnp
Copy link
Author

blecorre-mnp commented Feb 24, 2025

No worries, it's the least I can do! I've managed to make things work by migrating a few types outside of Gel, into our headless CMS. I've also deleted old deprecated types. I've also tried using --target=esm on the repro, doesn't seem to work with a simple tsc --noEmit index.ts.

We have somewhat of a complex schema due to the fact that I've chosen to bet a lot on Gel's computed properties, especially for our invoicing / quotes / invoices modules. After having such a schema in production for a little more than a year now, maybe we've reached Gel's natural technical limitation?

Anyway thank you for spending time on this, I hope it wont be too much of a bother!

@scotttrinh
Copy link
Collaborator

After having such a schema in production for a little more than a year now, maybe we've reached Gel's natural technical limitation?

You're definitely bumping into the edges of the complexity that maybe the type-system translation that the query builder is doing between EdgeQL and TypeScript. The query builder has always been a pretty ambitious project trying to maintain the type safety for arbitrarily complex expressions 😅 Gel itself is happy with really complex schemas, though, so keep on keeping on and we'll get this patched up.

Anyway thank you for spending time on this, I hope it wont be too much of a bother!

No bother at all, this is the job 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug upstream:edgedb Issue produced by changes to EdgeDB/EdgeQL
Projects
None yet
Development

No branches or pull requests

2 participants