-
-
Notifications
You must be signed in to change notification settings - Fork 818
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
Read and use the connectionParams
from operation extensions
#4781
Conversation
🦋 Changeset detectedLatest commit: 1495e11 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Benchmark Results
|
💻 Website PreviewThe latest changes are available as preview in: https://83536ef3.graphql-tools.pages.dev |
packages/loaders/url/src/index.ts
Outdated
// additional connection params can be supplied through the "webSocketConnectionParams" field in extensions. | ||
// TODO: connection params only from the FIRST operation in lazy mode will be used (detect connectionParams changes and reconnect, too implicit?) | ||
if (extensions?.['webSocketConnectionParams'] && typeof extensions?.['webSocketConnectionParams'] === 'object') { | ||
executorConnectionParams = Object.assign(executorConnectionParams, extensions['webSocketConnectionParams']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like leaking because everytime you call executor, it manipulates the "global" object.
executorConnectionParams = Object.assign(executorConnectionParams, extensions['webSocketConnectionParams']); | |
const requestConnectionParams = Object.assign({}, executorConnectionParams, extensions['webSocketConnectionParams']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it should manipulate the global object, the executorConnectionParams
are used by the connectionParams option in graphql-ws createClient above, see here:
graphql-tools/packages/loaders/url/src/index.ts
Lines 526 to 530 in 7acc717
connectionParams: () => { | |
const optionsConnectionParams = | |
(typeof connectionParams === 'function' ? connectionParams() : connectionParams) || {}; | |
return Object.assign(optionsConnectionParams, executorConnectionParams); | |
}, |
webSocketConnectionParams
from operation extensionsconnectionParams
from operation extensions
7acc717
to
1495e11
Compare
Continuation task of ardatan/graphql-mesh#4724
Uses the
connectionParams
from the operation extensions to extend the WebSocket connection parameters.Are there any security implications with doing this?