Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Display correct key name for api key (#594)

r33drichards0619540d6ef2
diff --git a/.changeset/smooth-foxes-cheat.md b/.changeset/smooth-foxes-cheat.md
new file mode 100644
index 000000000..3a0645052
--- /dev/null
+++ b/.changeset/smooth-foxes-cheat.md
@@ -0,0 +1,5 @@
+---
+'@e2b/cli': patch
+---
+
+Update error message to display correct key name
diff --git a/packages/cli/src/api.ts b/packages/cli/src/api.ts
index f8a77b60b..6865992f1 100644
--- a/packages/cli/src/api.ts
+++ b/packages/cli/src/api.ts
@@ -7,11 +7,11 @@ import { asBold, asPrimary } from './utils/format'
export let apiKey = process.env.E2B_API_KEY
export let accessToken = process.env.E2B_ACCESS_TOKEN
-const authErrorBox = boxen.default(
+const authErrorBox =(keyName: string) => boxen.default(
`You must be logged in to use this command. Run ${asBold('e2b auth login')}.
If you are seeing this message in CI/CD you may need to set the ${asBold(
- 'E2B_ACCESS_TOKEN'
+ `${keyName}`
)} environment variable.
Visit ${asPrimary(
'https://e2b.dev/docs/getting-started/api-key'
@@ -34,7 +34,7 @@ export function ensureAPIKey() {
}
if (!apiKey) {
- console.error(authErrorBox)
+ console.error(authErrorBox('E2B_API_KEY'))
process.exit(1)
} else {
return apiKey
@@ -58,7 +58,7 @@ export function ensureAccessToken() {
}
if (!accessToken) {
- console.error(authErrorBox)
+ console.error(authErrorBox('E2B_ACCESS_TOKEN'))
process.exit(1)
} else {
return accessToken