question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: DOMException: Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'http' is not allowed.

See original GitHub issue

I have a Quickstart installation on an external server “apicurio.example.com” (anonymized). I use an apache proxy server to access the site (both http). I can create an API but can not edit. Javascript reports an error (below). What configuration item might be missing / incorrect?

[ApisPageComponent] loadAsyncPageData
[ApisService] Getting all APIs
[ApisService] Fetching API list: http://apicurio.example.com/api-hub/designs
[ApiDetailPageComponent] Loading async page data
[ApisService] Getting an API Design: http://apicurio.example.com/api-hub/designs/1
[ApisService] Getting contributors: http://apicurio.example.com/api-hub/designs/1/contributors
[ApisService] Getting all activity for API 1
[ApisService] Fetching API design activity: http://apicurio.example.com/api-hub/designs/1/activity?end=10
[ApisService] Getting collaborators for API Design 1
[ApisService] Fetching collaborator list: http://apicurio.example.com/api-hub/designs/1/collaborators
[ApiDetailPageComponent] Contributors data loaded: {totalEdits: 1, contributors: Array(1)}
[ApiDetailPageComponent] Activity data loaded
[ValidationService] Getting all validation profiles
[ValidationService] Fetching validation profiles: http://apicurio.example.com/api-hub/validationProfiles
[ApiEditorPageComponent] Loading async page data
[ApisService] Getting an API Design: http://apicurio.example.com/api-hub/designs/1
[ApisService] Editing API Design: http://apicurio.example.com/api-hub/designs/1/session
[ApisService] Editing Session UUID: a88b9d13-fb2b-43e5-aaec-31fecb1df0a7
[ApisService] Content Version: 1
[ApiEditorPageComponent] Definition loaded.  Opening editing session.
[ApisService] Opening editing session on URL: http://apicurio.example.com/api-editing/designs/1?uuid=a88b9d13-fb2b-43e5-aaec-31fecb1df0a7&user=email%40example.com&secret=eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJYUEFkZElNQ21P
[ApiEditorPageComponent] **Error editing API design.** (anonymous)
    **Error: DOMException: Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'http' is not allowed.**
    at t.openEditingSession (http://apicurio.example.com/studio/main.d73499da517a45f6f776.js:1:2954806)
    at http://apicurio.example.com/studio/main.d73499da517a45f6f776.js:1:4400322
    at e.invoke (http://apicurio.example.com/studio/polyfills.9c67d1be23abf75fea1a.js:1:7375)
    at Object.onInvoke (http://apicurio.example.com/studio/main.d73499da517a45f6f776.js:1:1918717)
    at e.invoke (http://apicurio.example.com/studio/polyfills.9c67d1be23abf75fea1a.js:1:7315)
    at t.run (http://apicurio.example.com/studio/polyfills.9c67d1be23abf75fea1a.js:1:2578)
    at http://apicurio.example.com/studio/polyfills.9c67d1be23abf75fea1a.js:1:14042
    at e.invokeTask (http://apicurio.example.com/studio/polyfills.9c67d1be23abf75fea1a.js:1:8059)
    at Object.onInvokeTask (http://apicurio.example.com/studio/main.d73499da517a45f6f776.js:1:1918629)
    at e.invokeTask (http://apicurio.example.com/studio/polyfills.9c67d1be23abf75fea1a.js:1:7980)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dbtechcommented, Aug 14, 2019

Thank you! That has the hint I needed. In addition, I have also understood that the whole protocol stack must be configured uniformly either with or without ssl. That is important for configuring the proxy.

0reactions
EricWittmanncommented, Sep 10, 2020

Try changing the value in that APICURIO_UI_EDITING_URL ENV var you are supplying from https to wss. Websocket connections still go over port 80/443 so your routes should be fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to construct 'WebSocket': The URL's scheme must be ...
Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'vscode-webview' is not allowed #145093.
Read more >
Wrong url scheme for WebSocket - Stack Overflow
A WebSocket needs ws:// or wss:// (for SSL) instead of http:// . However, the problem in your code is that the statement @routes....
Read more >
Problems with the root websocket support - Newbie
Uncaught DOMException: Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'file' is not allowed. at ...
Read more >
Remove completeURL() call from WebSocket construction ...
-PASS new WebSocket(null) threw exception SyntaxError: Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'http' is not allowed...
Read more >
WebSockets Standard
url is a string giving the URL over which the connection is established. Only " ws " or " wss " schemes are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found