Skip to content

docs(cursor-sdk): non-null assertion performs no runtime check - #488

Open
lab1207 wants to merge 1 commit into
cursor:mainfrom
lab1207:fix/auth-non-null-assertion
Open

lab1207 wants to merge 1 commit into
cursor:mainfrom
lab1207:fix/auth-non-null-assertion

Conversation

@lab1207

@lab1207 lab1207 commented Oct 2, 2026 •

Copy link
Copy Markdown

Fixes #473.

The page claimed the postfix ! means "fail loudly if the env var is missing", but it is a compile-time-only assertion, erased in emitted JavaScript. With the var unset, undefined passes through and fails later in the SDK. Reworded to state what ! actually does and point at the explicit check below it, which is the real loud failure.


Note

Low Risk
Documentation-only correction in auth reference; no runtime or API behavior changes.

Overview
Corrects misleading auth docs around process.env.CURSOR_API_KEY! in the minimum-viable setup section.

The text no longer says the postfix ! will “fail loudly” when the env var is missing. It now states that ! is compile-time only (no runtime check), that a missing var yields undefined and a later SDK auth error, and that the explicit if (!apiKey) block below is what actually fails fast at the call site.

Reviewed by Cursor Bugbot for commit b492b67. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cursor-sdk auth.md: non-null assertion described as a runtime missing-variable check

1 participant