graphql-hive / graphql-hive/envelop

useSchemaByContext and usePrometheus are not compatible

Open
#2,559 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
827
Forks
132
PR merge metrics
No merged PRs in 30d

Description

When schema is loaded with useSchemaByContext async function then usePrometheus crashes with:

```
TypeError: schema.getRootType is not a function
at TypeInfo.enter (/app/node_modules/.pnpm/graphql@16.10.0/node_modules/graphql/utilities/TypeInfo.js:162:33)
at Object.enter (/app/node_modules/.pnpm/graphql@16.10.0/node_modules/graphql/utilities/TypeInfo.js:387:16)
at visit (/app/node_modules/.pnpm/graphql@16.10.0/node_modules/graphql/language/visitor.js:197:21)
at extractDeprecatedFields (file:///app/node_modules/.pnpm/@envelop+prometheus@12.1.3_@envelop+core@5.2.3_graphql@16.10.0_prom-client@15.1.3/node_modules/@envelop/prometheus/esm/utils.js:235:5)
at handler (file:///app/node_modules/.pnpm/@envelop+prometheus@12.1.3_@envelop+core@5.2.3_graphql@16.10.0_prom-client@15.1.3/node_modules/@envelop/prometheus/esm/index.js:261:42)
at file:///app/node_modules/.pnpm/@envelop+prometheus@12.1.3_@envelop+core@5.2.3_graphql@16.10.0_prom-client@15.1.3/node_modules/@envelop/prometheus/esm/index.js:304:43
at Array.forEach ()\n at file:///app/node_modules/.pnpm/@envelop+prometheus@12.1.3_@envelop+core@5.2.3_graphql@16.10.0_prom-client@15.1.3/node_modules/@envelop/prometheus/esm/index.js:304:18
at file:///app/node_modules/.pnpm/@envelop+core@5.2.3/node_modules/@envelop/core/esm/orchestrator.js:123:17
at requestListener (file:///app/node_modules/.pnpm/@workspace+un-yoga@file++++source+packages+un-yoga/node_modules/@workspace/un-yoga/build/src/builder.js:55:38)"},"msg":"Error in GraphQL request"}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the crash with useSchemaByContext and usePrometheus, then inspect the @envelop/prometheus stack-trace entry points, especially extractDeprecatedFields and handler. Trace the value passed as schema and identify the compatibility boundary; done means the same setup no longer throws the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, prometheus
Domain
api, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.