Skip to content

Commit

Permalink
emit error page if wssER connections fail
Browse files Browse the repository at this point in the history
  • Loading branch information
rentallect committed Jul 9, 2024
1 parent 55b70cc commit 52a0500
Show file tree
Hide file tree
Showing 4 changed files with 557 additions and 60 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"@auth0/auth0-spa-js": "^2.0.4",
"@azure/msal-browser": "^2.38.0",
"@babel/runtime": "^7.17.9",
"@openziti/ziti-browzer-core": "^0.40.5",
"@openziti/ziti-browzer-core": "^0.41.0",
"bowser": "^2.11.0",
"cookie-interceptor": "^1.0.0",
"core-js": "^3.22.8",
Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const ZBR_CONSTANTS =
ZBR_ERROR_CODE_PKCE_CALLBACK_ERROR: 1013,
ZBR_ERROR_CODE_ORIGIN_TRIAL_SUBDOMAIN_MISMATCH: 1014,
ZBR_ERROR_CODE_ORIGIN_TRIAL_TOKEN_INVALID: 1015,
ZBR_ERROR_CODE_WSS_ROUTER_CONNECTION_ERROR: 1016,

};

Expand Down
20 changes: 20 additions & 0 deletions src/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,19 @@ class ZitiBrowzerRuntime {

}

wssERConnectionErrorEventHandler(wssERConnectionErrorEvent) {

this.logger.trace(`wssERConnectionErrorEventHandler() `, wssERConnectionErrorEvent);

window.zitiBrowzerRuntime.browzer_error({
status: 409,
code: ZBR_CONSTANTS.ZBR_ERROR_CODE_WSS_ROUTER_CONNECTION_ERROR,
title: `Error Encountered Attempting to Connect to Edge Router [${wssERConnectionErrorEvent.wsser}]`,
message: `Possible Edge Router configuration|certificates issue exists.`
});

}

noServiceEventHandler(noServiceEvent) {

this.logger.trace(`noServiceEventHandler() `, noServiceEvent);
Expand Down Expand Up @@ -1516,6 +1529,7 @@ class ZitiBrowzerRuntime {
this.zitiContext.on(ZITI_CONSTANTS.ZITI_EVENT_XGRESS, this.xgressEventHandler);
this.zitiContext.on(ZITI_CONSTANTS.ZITI_EVENT_NESTED_TLS_HANDSHAKE_TIMEOUT, this.nestedTLSHandshakeTimeoutEventHandler);
this.zitiContext.on(ZITI_CONSTANTS.ZITI_EVENT_NO_CONFIG_PROTOCOL_FOR_SERVICE, this.noConfigProtocolForServiceEventHandler);
this.zitiContext.on(ZITI_CONSTANTS.ZITI_EVENT_WSS_ROUTER_CONNECTION_ERROR, this.wssERConnectionErrorEventHandler);

if (options.eruda) {
this.zitiConfig.eruda = true;
Expand Down Expand Up @@ -2003,6 +2017,12 @@ if (isUndefined(window.zitiBrowzerRuntime)) {

}

else if (event.data.type === 'WSS_ROUTER_CONNECTION_ERROR') {

window.zitiBrowzerRuntime.wssERConnectionErrorEventHandler(event.data.payload.event);

}

else if (event.data.type === 'SESSION_CREATION_ERROR') {

window.zitiBrowzerRuntime.sessionCreationErrorEventHandler(event.data.payload.event);
Expand Down
Loading

0 comments on commit 52a0500

Please sign in to comment.