Skip to content

Latest commit

 

History

History
89 lines (64 loc) · 3.39 KB

File metadata and controls

89 lines (64 loc) · 3.39 KB
title Start the Application
description Run the application and confirm the LaunchDarkly SDK initializes successfully

Start the Application

After installing the SDK and adding initialization code, verify the application starts and the SDK connects.

Step 1: Identify the Run Command

Find how the project is normally started:

Indicator Run Command
package.json "scripts"."start" npm start or npm run dev
package.json "scripts"."dev" npm run dev
Makefile with run target make run
manage.py (Django) python manage.py runserver
app.py or main.py (Flask/FastAPI) python app.py or uvicorn main:app
go.mod go run . or go run cmd/server/main.go
Gemfile with Rails bin/rails server
Cargo.toml cargo run

If the project has a README with run instructions, follow those.

Step 2: Start the Application

Run the application. Do NOT rely on specific log messages to determine success — different SDKs log differently and some don't log at all.

What to Look For

  • The application starts without crashing
  • No import errors or module-not-found errors
  • The app is responsive (e.g., serves HTTP requests, renders UI)

Common Startup Errors

  • Module not found or ImportError — the SDK wasn't installed correctly. Re-run the install command.
  • TypeError or undefined — initialization code may have a syntax issue. Check the code against the SDK recipe.
  • Network timeout — the SDK can't reach LaunchDarkly (check firewall/proxy settings).
  • App crashes on startup — check if the SDK key environment variable is set.

Important: The SDK may initialize silently. Do not assume failure just because you don't see a success log message. The actual validation happens in the next step using the sdk-active endpoint.

Step 3: Handle Common Issues

Issue Solution
SDK key not set Remind the user to set the LAUNCHDARKLY_SDK_KEY environment variable
Module not found Re-run the install command; check the dependency file
Initialization timeout Check network connectivity; verify the SDK key is valid
Type errors Check the import statement matches the SDK version
App starts but no SDK log Verify the initialization code is actually being executed (not behind a conditional)

Step 4: Confirm SDK Activity

Once the application is running, use the sdk-active endpoint to confirm the SDK has connected to LaunchDarkly. This is the definitive check — not log messages.

Use ldcli if available:

ldcli sdk-active \
  --access-token YOUR_ACCESS_TOKEN \
  --project PROJECT_KEY \
  --environment ENVIRONMENT_KEY

Or call the API directly:

curl -s -X GET \
  "https://app.launchdarkly.com/api/v2/projects/PROJECT_KEY/environments/ENVIRONMENT_KEY/sdk-active" \
  -H "Authorization: LAUNCHDARKLY_ACCESS_TOKEN"

If the SDK is not yet active, wait 30 seconds and retry — the SDK needs to send at least one event to LaunchDarkly before it shows as active.

If you cannot start the application (e.g., it requires infrastructure the agent doesn't have access to), ask the user to start it manually and confirm it's running.

Status

[STATUS] Identifying run command
[STATUS] Starting application
[STATUS] Checking SDK initialization

Upon completion, continue with: Validate SDK Connection