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
65 |return undefined;
66 | },
67 |onParse() {
68 |return ({ result: document, context: { params, request } }) => {
69 | const operationAST = getOperationAST(document, params.operationName);
70 | paramsByRequest.set(request, {
^
TypeError: WeakMap keys must be objects or non-registered symbols
at /Users/snigdhasingh/Development/bun-graphql-yoga-prometheus/node_modules/@graphql-yoga/plugin-prometheus/esm/index.js:70:33
at /Users/snigdhasingh/Development/bun-graphql-yoga-prometheus/node_modules/@envelop/core/esm/orchestrator.js:111:17
at /Users/snigdhasingh/Development/bun-graphql-yoga-prometheus/src/index.ts:71:17
at onSubscribe (/Users/snigdhasingh/Development/bun-graphql-yoga-prometheus/src/index.ts:60:23)
at /Users/snigdhasingh/Development/bun-graphql-yoga-prometheus/node_modules/graphql-ws/lib/server.mjs:146:124
at onMessage (/Users/snigdhasingh/Development/bun-graphql-yoga-prometheus/node_modules/graphql-ws/lib/server.mjs:51:61)
Comment out the usePrometheus plugin, run the subscription again, works as expected
Expected behavior
I expected the subscription to return data
Screenshots or Videos
No response
Platform
OS: macOS
Bun: 1.1.13
@graphql-yoga/* version(s): 5.6.1
Additional context
No response
The text was updated successfully, but these errors were encountered:
snigdha920
changed the title
@graphql-yoga/plugin-prometheus breaks subscriptions over graphql-ws @graphql-yoga/plugin-prometheus breaks subscriptions over graphql-ws
Jul 18, 2024
snigdha920
changed the title
@graphql-yoga/plugin-prometheus breaks subscriptions over graphql-ws
@graphql-yoga/plugin-prometheus breaks subscriptions over graphql-ws
Jul 18, 2024
When using subscriptions there is no request in the context, and we still try to use it as a key for setting params, adding something like:
// When parsing subscriptions, there is no requestif(!request){return;}paramsByRequest.set(request,{
document,operationName: operationAST?.name?.value,operationType: operationAST?.operation});
fixes the issue.
But I'm also not sure why we're using request as a key, in the original @envelop/prometheus they use the entire context, which already takes care of this condition:
Describe the bug
On installing the prometheus plugin, subscriptions fail with the error:
If we comment out the plugin, subscriptions work again.
If we use the plugins from
@envelop/prometheus
, the subscriptions work again, but http://localhost:4000/metrics gives a 404.What is the correct way to use the plugin with graphql-ws subscriptions?
I can also open a PR but will need guidance on what the fix is.
Your Example Website or App
https://github.com/snigdha920/bun-graphql-yoga-prometheus/tree/main
Steps to Reproduce the Bug or Issue
bun dev
and this error in the console:
usePrometheus
plugin, run the subscription again, works as expectedExpected behavior
I expected the subscription to return data
Screenshots or Videos
No response
Platform
@graphql-yoga/*
version(s): 5.6.1Additional context
No response
The text was updated successfully, but these errors were encountered: