You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
● nexus:build get used plugins
● nexus:plugin:nexusPluginPrisma Running generators
● nexus:build starting reflection
✕ nexus reflection failed
| error Error: A metric with the name graphql_queries_resolved has already been registered.
| at Registry.registerMetric (/Users/hays/haysclark/nexus-plugin-reporting-example/node_modules/prom-client/lib/reg
istry.js:76:10)
| at Counter.config.registers.forEach.registryInstance (/Users/hays/haysclark/nexus-plugin-reporting-example/node_m
odules/prom-client/lib/counter.js:64:21)
| at Array.forEach (<anonymous>)
| at new Counter (/Users/hays/haysclark/nexus-plugin-reporting-example/node_modules/prom-client/lib/counter.js:63:2
0)
| at Object.reportingPlugin (/Users/hays/haysclark/nexus-plugin-reporting-example/api/reporting/lib/schema/index.ts
:15:20)
| at Object.run (/Users/hays/haysclark/nexus-plugin-reporting-example/api/reporting/runtime.ts:22:18)
| at gotManifests.data.filter.map.map (/Users/hays/haysclark/nexus-plugin-reporting-example/node_modules/nexus/src/
lib/plugin/load.ts:34:21)
| at Array.map (<anonymous>)
| at Object.importAndLoadRuntimePlugins (/Users/hays/haysclark/nexus-plugin-reporting-example/node_modules/nexus/sr
c/lib/plugin/load.ts:32:6)
| at run (/Users/hays/haysclark/nexus-plugin-reporting-example/node_modules/nexus/src/lib/reflection/fork-script.ts
:30:30)
...
The reporting plugin I authored uses prom-client, which keeps track of all the Metric Names used, and validates that no string is re-used. Clearly the nexus:build starting reflection step is running the code a 2nd time, resulting in the error. Currently, I have workaround the issue by creating a Singleton object that contains all the reporting methods and injecting that instance into my /lib/schema/index.ts file. It works... but at its core, it's a hack to circumvent the build issue.
Is this issue a limitation with the reflection build step that could be tweaked? Or am I doing something wrong with the way I structured my plug-in?
I have published the erroring code in the reflection-failed branch of my repo.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When authoring my haysclark/nexus-plugin-reporting-example I encountered an error when I stopped using
nexus dev
and tried usingnexus build
.The reporting plugin I authored uses prom-client, which keeps track of all the Metric Names used, and validates that no string is re-used. Clearly the nexus:build starting reflection step is running the code a 2nd time, resulting in the error. Currently, I have workaround the issue by creating a Singleton object that contains all the reporting methods and injecting that instance into my
/lib/schema/index.ts
file. It works... but at its core, it's a hack to circumvent the build issue.Is this issue a limitation with the reflection build step that could be tweaked? Or am I doing something wrong with the way I structured my plug-in?
I have published the erroring code in the reflection-failed branch of my repo.
Cheers.
Beta Was this translation helpful? Give feedback.
All reactions