Skip to content

fix: align README with env-var setup and restore missing client-side ID guard - #19

Draft
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1786957430-readme-env-vars
Draft

fix: align README with env-var setup and restore missing client-side ID guard#19
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1786957430-readme-env-vars

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Routine SDK audit of this example. launchdarkly-node-client-sdk needed no version change: the manifest declares >= 3.4.0, latest on npm is 3.4.3, and there is no committed lock file, so npm install already resolves to the latest 3.x. No deprecated SDK APIs are used (initialize, waitForInitialization(timeout), variation, on('change:...') are all current; no deprecation warnings on install or run).

Two real defects found instead:

  1. README was stale — it told users to edit index.js and set a variable environmentId that does not exist (the code reads LAUNCHDARKLY_CLIENT_SIDE_ID / LAUNCHDARKLY_FLAG_KEY), and quoted an output line the app no longer prints. Rewrote the build instructions in the same shape as hello-node-server.

  2. The "please set your client-side ID" guard was dead code:

-const clientSideId = process.env.LAUNCHDARKLY_CLIENT_SIDE_ID ?? 'your-client-side-id';
+const clientSideId = process.env.LAUNCHDARKLY_CLIENT_SIDE_ID ?? '';
 ...
 if (!clientSideId) { /* never reached before: the placeholder is truthy */ }

Without the env var the example previously tried to initialize with the literal your-client-side-id and failed with an opaque SDK error instead of the intended message.

Titled fix: rather than chore: because it touches shipped example code.

Validation

$ npm install                      # installs launchdarkly-node-client-sdk 3.4.3, 0 vulnerabilities
$ LAUNCHDARKLY_CLIENT_SIDE_ID=<client-side id> CI=1 node index.js
info: [LaunchDarkly] LaunchDarkly client initialized
*** SDK successfully initialized!
*** The 'sample-feature' feature flag evaluates to false.

$ node index.js                    # no env var
*** Please set LAUNCHDARKLY_CLIENT_SIDE_ID to your client-side ID, or edit index.js to use your client-side ID.
(exit 1)

Limitations

Node console app, so no screenshots. Repo CI (verify-hello-app) skips markdown-only changes but runs for the index.js change.

Link to Devin session: https://app.devin.ai/sessions/a4f2f04fc40f4596aa5f7dd97ef1a223

…ID guard

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@cursor review

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants