From 88086e4a80d7841d28188366a469800afa281693 Mon Sep 17 00:00:00 2001 From: spypsy Date: Thu, 31 Aug 2023 10:22:30 +0100 Subject: [PATCH] fix: ensure CLI command doesn't fail due to missing client version (#1895) Please provide a paragraph or two giving a summary of the change, including relevant motivation and context. # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [ ] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [ ] Every change is related to the PR description. - [ ] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist). --- yarn-project/aztec-cli/src/client.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yarn-project/aztec-cli/src/client.ts b/yarn-project/aztec-cli/src/client.ts index 9a3bedbc283..7124e3682a7 100644 --- a/yarn-project/aztec-cli/src/client.ts +++ b/yarn-project/aztec-cli/src/client.ts @@ -56,6 +56,9 @@ class VersionMismatchError extends Error {} export async function checkServerVersion(rpc: AztecRPC, expectedVersionRange: string, logger?: DebugLogger) { const serverName = 'Aztec Sandbox'; const { client } = await rpc.getNodeInfo(); + if (!client) { + throw new VersionMismatchError(`Couldn't determine ${serverName} version. You may run into issues.`); + } const version = client.split('@')[1]; logger?.debug(`Comparing server version ${version} against CLI expected ${expectedVersionRange}`); if (!version || !valid(version)) {