Skip to content

Fix: Inject API key into production builds#155

Merged
theunavailableguy merged 1 commit into
masterfrom
fix/add-api-key-to-release-build
Jul 12, 2026
Merged

Fix: Inject API key into production builds#155
theunavailableguy merged 1 commit into
masterfrom
fix/add-api-key-to-release-build

Conversation

@AIEraDev

Copy link
Copy Markdown
Owner

Problem

Production users are experiencing errors when accessing the audio library feature. This is because:

  1. The Clypra API endpoint () requires authentication via header
  2. The API key is loaded from environment variable in apiUtils.ts
  3. During local development, Vite loads this from file (which is gitignored)
  4. In production releases, the environment variable was not being injected during the build process
  5. Result: Production binaries have an empty API key → 401 Unauthorized errors → "Load failed" for users

Solution

Updated to inject from GitHub repository secrets during the production build step:

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
  TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
  VITE_CLYPRA_API_KEY: ${{ secrets.VITE_CLYPRA_API_KEY }}  # ← Added

Required Action Before Release

IMPORTANT: Add the API key to GitHub repository secrets:

  1. Go to SettingsSecrets and variablesActions
  2. Click New repository secret
  3. Name:
  4. Value: Your production API key (e.g., )

Testing

Verified the API key works:

# Without key - fails
curl https://clypra-worker-api.abdulkabirmusa.com/audio/music
# {"error":"Unauthorized: Missing API Key"}

# With key - succeeds
curl -H "X-API-Key: V7V2TWjNBH0WUN0y2Rt4QA61KY8bGWI93HnlmR9cK8I=" \
     https://clypra-worker-api.abdulkabirmusa.com/audio/music
# [... audio library data ...]

Impact

  • ✅ Fixes audio library "Load failed" errors for all production users
  • ✅ No code changes needed - only workflow configuration
  • ✅ Maintains security by using GitHub secrets
  • ✅ Works for all platforms (Windows, macOS, Linux)

Next Steps

  1. Merge this PR
  2. Add to GitHub secrets (if not already added)
  3. Create new release (v1.0.7) to rebuild with embedded API key
  4. Users will get working audio library feature

- Added VITE_CLYPRA_API_KEY environment variable to release build step
- Fixes 401 Unauthorized errors in production audio library API calls
- API key must be configured in GitHub repository secrets
- Resolves 'Load failed' error for users accessing audio library features
- Environment variable gets embedded in Tauri production binaries during compilation
@theunavailableguy
theunavailableguy merged commit e4c3d41 into master Jul 12, 2026
2 of 3 checks passed
@theunavailableguy
theunavailableguy deleted the fix/add-api-key-to-release-build branch July 12, 2026 19:31
@AIEraDev
AIEraDev restored the fix/add-api-key-to-release-build branch July 12, 2026 19:38
@AIEraDev
AIEraDev deleted the fix/add-api-key-to-release-build branch July 12, 2026 20:13
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.

2 participants