diff --git a/lib/web/apiserver.go b/lib/web/apiserver.go index 5833d7de50bd6..153867a7869b9 100644 --- a/lib/web/apiserver.go +++ b/lib/web/apiserver.go @@ -3821,6 +3821,7 @@ func (h *Handler) writeErrToWebSocket(ws *websocket.Conn, err error) { return } errEnvelope := terminal.Envelope{ + Version: defaults.WebsocketVersion, Type: defaults.WebsocketError, Payload: trace.UserMessage(err), } diff --git a/web/packages/teleport/src/lib/term/protobuf.js b/web/packages/teleport/src/lib/term/protobuf.js index c47cde49f7926..0aa52cf9148af 100644 --- a/web/packages/teleport/src/lib/term/protobuf.js +++ b/web/packages/teleport/src/lib/term/protobuf.js @@ -30,6 +30,7 @@ export const MessageTypeEnum = { FILE_TRANSFER_REQUEST: 'f', FILE_TRANSFER_DECISION: 't', WEBAUTHN_CHALLENGE: 'n', + ERROR: 'e', LATENCY: 'l', }; @@ -58,6 +59,7 @@ export const messageFields = { event: MessageTypeEnum.AUDIT.charCodeAt(0), close: MessageTypeEnum.SESSION_END.charCodeAt(0), challengeResponse: MessageTypeEnum.WEBAUTHN_CHALLENGE.charCodeAt(0), + error: MessageTypeEnum.ERROR.charCodeAt(0), }, }, }; diff --git a/web/packages/teleport/src/lib/term/tty.ts b/web/packages/teleport/src/lib/term/tty.ts index 703282bdcc2de..018b1d8c3a0d1 100644 --- a/web/packages/teleport/src/lib/term/tty.ts +++ b/web/packages/teleport/src/lib/term/tty.ts @@ -200,6 +200,9 @@ class Tty extends EventEmitterWebAuthnSender { this.emit(TermEvent.DATA, msg.payload); } break; + case MessageTypeEnum.ERROR: + this.emit(TermEvent.DATA, msg.payload + '\n'); + break; case MessageTypeEnum.LATENCY: this.emit(TermEvent.LATENCY, msg.payload); break;