Akryum / Akryum/vue-cli-plugin-apollo

Uncaught DOMException: Failed to construct 'WebSocket': The URL 'undefined' is invalid.

Offen
#155 4 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
need repro
Vorherrschende Sprache
JavaScript
Sterne
477
Forks
109
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

version 0.20.0

When wsEndpoint is added to the _createProvider_ configuration this error is returned

`Uncaught DOMException: Failed to construct 'WebSocket': The URL 'undefined' is invalid.`
![image](https://user-images.githubusercontent.com/8209966/59604710-33bae700-910d-11e9-9534-290ff53d07b3.png)

The reason is that wsClient created in `./node_modules/vue-cli-plugin-apollo/graphql-client/dist/index.js` uses a different SubscriptionClient constructor than apollo-link-ws. Hence this check fails
![image](https://user-images.githubusercontent.com/8209966/59607531-c9597500-9113-11e9-8ecc-27c48acb521a.png)

A new SubscriptionClient is created passing paramsOrClient.uri, which is undefined.
paramsOrClient exposes .url, not .uri.

apollo-link-ws uses SubscriptionClient from `./node_modules/subscriptions-transport-ws`
![image](https://user-images.githubusercontent.com/8209966/59607795-47b61700-9114-11e9-9bd5-3aae0a88f02c.png)
while `./node_modules/vue-cli-plugin-apollo/graphql-client/dist/index.js` uses SubscriptionClient from `./node_modules/vue-cli-plugin-apollo/node_modules/subscriptions-transport-ws`
![image](https://user-images.githubusercontent.com/8209966/59607943-9cf22880-9114-11e9-8fa9-6c4972fdcd82.png)

Manually removing` ./node_modules/vue-cli-plugin-apollo/node_modules/subscriptions-transport-ws` fixes it in that webpack uses ./node_modules/subscriptions-transport-ws for both.

I think the plugin should be released without subscriptions-transport-ws in node_modules

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.