Troubleshooting
This guide helps you diagnose and resolve common issues when using Beacon with your Laravel application.
Common Issues
Authentication and API Issues
Invalid API Token
Symptoms:
- 401 Unauthorized responses
- "Invalid API token" error messages
- Feature flags always returning inactive
Solutions:
Verify your API token in the
.env
file:dotenvBEACON_ACCESS_TOKEN=your_actual_token_here
Check that the token hasn't expired or been revoked in the Beacon dashboard
Ensure the token has the correct permissions for your application
Clear your configuration cache:
bashphp artisan config:clear
API Connection Issues
Symptoms:
- Timeout errors
- Connection refused errors
- Intermittent feature flag failures
Solutions:
Check your API URL configuration:
dotenvBEACON_API_URL=https://beacon-hq.dev
Verify network connectivity:
bashcurl -I https://beacon-hq.dev/up
Check firewall and proxy settings
Configuration Issues
Application or Environment Not Found
Symptoms:
- Feature flags not working in specific environments
- Inconsistent behavior across environments
Solutions:
Verify application name matches exactly:
dotenvAPP_NAME=my-exact-app-name # OR BEACON_APP_NAME=my-exact-app-name
Check environment name:
dotenvAPP_ENV=production # OR BEACON_ENVIRONMENT=production
Cache Issues
Symptoms:
- Stale feature flag values
- Changes not reflecting immediately
- Inconsistent behavior
Solutions:
Clear application cache:
bashphp artisan cache:clear
Clear Beacon-specific cache:
bashphp artisan cache:forget beacon:*
Adjust cache TTL for faster updates:
dotenvBEACON_CACHE_TTL=300 # 5 minutes instead of 30
Disable caching temporarily for debugging:
dotenvBEACON_CACHE_TTL=0
Feature Flag Issues
Feature Flag Always Return Inactive
Symptoms:
- Feature flags never activate
Solutions:
Check if the feature flag exists in Beacon dashboard
Verify the feature flag is enabled for your environment
Check policy configuration and targeting rules
Test with a simple "always on" policy first
Verify context data is being sent correctly:
php// Add debug logging Log::info('Feature flag context', [ 'flag' => 'my-flag', 'context' => Feature::for($user)->context('my-flag'), ]);
Use Beacon's Code feature to create an API request to test with.
Inconsistent Feature Flag Behavior
Symptoms:
- Feature flags work sometimes but not others
- Different behavior for same user
- Random activation/deactivation
Solutions:
Verify policy logic and expressions
Check for caching issues (see Cache Issues section)
Review Rollout and Variants configuration
Performance Issues
Slow Feature Flag Evaluation
Symptoms:
- High response times
- Timeouts during feature flag checks
- Application performance degradation
Solutions:
- Enable and optimize caching:dotenv
BEACON_CACHE_TTL=1800 BEACON_CACHE_STORE=redis
High API Usage
Symptoms:
- Rate limiting errors (429 responses)
- High API costs
- Frequent cache misses
Solutions:
Increase cache TTL:
dotenvBEACON_CACHE_TTL=3600 # 1 hour
Review and optimize policy complexity
Getting Help
Before Contacting Support
- Check the Beacon Status Page for service issues
- Review your configuration against this documentation
- Test with a minimal reproduction case
- Gather relevant logs and error messages
Information to Include
When contacting support, include:
- Laravel version
- Beacon Pennant driver version
- Complete error messages and stack traces
- Relevant configuration (without sensitive data)
- Steps to reproduce the issue
- Expected vs actual behavior
Community Resources
Monitoring and Alerting
Set Up Monitoring
Monitor key metrics to catch issues early:
// Monitor API response times
Log::info('Beacon API call', [
'duration' => $duration,
'flag' => $flagName,
'result' => $result,
]);
// Monitor cache hit rates
Log::info('Beacon cache', [
'hit' => $cacheHit,
'flag' => $flagName,
]);
Health Checks
Implement health checks for Beacon connectivity:
// app/Http/Controllers/HealthController.php
public function beacon()
{
try {
$start = microtime(true);
Feature::define('health-check');
Feature::active('health-check');
$duration = microtime(true) - $start;
return response()->json([
'status' => 'healthy',
'response_time' => $duration,
]);
} catch (Exception $e) {
return response()->json([
'status' => 'unhealthy',
'error' => $e->getMessage(),
], 503);
}
}
Alerting
Set up alerts for:
- High error rates
- Slow response times
- Rate limiting issues
- Cache miss rates
This helps you identify and resolve issues before they impact users.