Troubleshooting Guide
Solutions to common issues when integrating ProtectMyAPI.
Quick tip: Most issues are caused by testing on simulators/emulators. Always test on a real device.
Attestation Issues
âAttestation failedâ
Symptoms:
- SDK returns
attestationFailederror - Requests are blocked
- Works in development, fails in production
Causes & Solutions:
iOS-specific causes:
| Cause | Solution |
|---|---|
| Testing on Simulator | Use a real iPhone/iPad â Simulator has no Secure Enclave |
| App Attest not enabled | Add App Attest capability in Xcode |
| Bundle ID mismatch | Verify Bundle ID matches dashboard exactly |
| Team ID incorrect | Check Apple Developer Portal for correct Team ID |
| Device is jailbroken | Use a non-jailbroken device |
| Debug build | Test with a release/TestFlight build |
Check App Attest capability:
- Open Xcode
- Select your target
- Go to Signing & Capabilities
- Ensure App Attest is listed
âApp not foundâ
Symptoms:
- Error code:
APP_NOT_FOUND - SDK fails to initialize
Solutions:
-
Verify App Token:
// Check this matches your dashboard exactly ProtectMyAPI.shared.configure(appId: "app_abc123...") -
Check organization:
- Ensure youâre looking at the correct organization in dashboard
- App tokens are organization-specific
-
Verify app exists:
- Go to Dashboard â Apps
- Confirm your app is listed
âSecurity violation detectedâ
Symptoms:
- Error during SDK initialization
- App crashes or blocks requests
Causes:
| Violation | Meaning |
|---|---|
| Jailbreak detected | iOS device is jailbroken |
| Root detected | Android device is rooted |
| Emulator detected | Running in simulator/emulator |
| Debugger attached | App is being debugged |
| Tampering detected | App binary was modified |
Solutions:
For development/testing only:
// iOS - Development only!
let config = ProtectMyAPIConfiguration(
appId: "app_...",
environment: .development,
allowJailbrokenDevices: true, // â ď¸ Never in production
allowSimulator: true // â ď¸ Never in production
)// Android - Development only!
val config = ProtectMyAPIConfiguration(
appId = "app_...",
environment = Environment.DEVELOPMENT,
allowRootedDevices = true, // â ď¸ Never in production
allowEmulator = true // â ď¸ Never in production
)Never disable security in production! These settings are for development only.
API & Secret Issues
âSecret not foundâ
Symptoms:
- Error code:
SECRET_NOT_FOUND - API calls fail with auth errors
Solutions:
-
Check secret name:
- Names are case-sensitive
- Verify spelling matches exactly
-
Verify secret exists:
- Go to Dashboard â Secrets
- Confirm the secret is listed
-
Check organization:
- Secrets are organization-specific
- Ensure youâre in the correct org
-
Check service binding:
- Go to API Services
- Verify secret is linked to the endpoint
âEndpoint not foundâ
Symptoms:
- Error code:
ENDPOINT_NOT_FOUND - 404 responses
Solutions:
-
Verify the slug:
// The slug must match exactly ProtectMyAPI.shared.request(endpoint: "openai-chat") -
Check service exists:
- Go to Dashboard â API Services
- Verify the endpoint is created
-
Check app linking:
- Go to Apps â Your App â Linked Services
- Verify the endpoint is linked
âRate limitedâ
Symptoms:
- Error code:
RATE_LIMITED - HTTP 429 responses
Solutions:
| Cause | Solution |
|---|---|
| ProtectMyAPI limit | Upgrade your plan |
| Provider limit | Check your providerâs rate limits |
| Per-device limit | Implement client-side throttling |
Handling rate limits:
catch ProtectMyAPIError.rateLimited(let retryAfter) {
// Wait and retry
try await Task.sleep(nanoseconds: UInt64(retryAfter) * 1_000_000_000)
// Retry the request
}âInvalid API keyâ (from provider)
Symptoms:
- Error from OpenAI/Anthropic/etc.
- âInvalid authenticationâ or âIncorrect API keyâ
Solutions:
-
Update the secret:
- Go to Dashboard â Secrets
- Edit the secret with the correct key
- Keys cannot be viewed, only replaced
-
Verify key format:
- OpenAI:
sk-... - Anthropic:
sk-ant-... - Google:
AIza...
- OpenAI:
-
Check key permissions:
- Some providers have project-specific keys
- Ensure the key has required scopes
Network Issues
âNetwork errorâ
Symptoms:
- Requests timeout
- Connection refused
- SSL errors
Solutions:
| Cause | Solution |
|---|---|
| No internet | Check device connectivity |
| Firewall blocking | Whitelist api.protectmyapi.com |
| SSL pinning issue | Update SDK to latest version |
| Proxy interference | Disable debugging proxies |
Check connectivity:
// iOS
if !NetworkMonitor.shared.isConnected {
showAlert("No internet connection")
return
}âTimeoutâ
Symptoms:
- Requests take too long
- Error code:
TIMEOUT
Solutions:
-
Increase timeout:
let config = ProtectMyAPIConfiguration( appId: "app_...", timeout: 60.0 // Increase from default 30s ) -
Check API endpoint:
- Some AI APIs are slow (image generation)
- Consider async/polling patterns
-
Check network quality:
- Test on better connection
- Implement retry logic
SDK Issues
âSDK not initializedâ
Symptoms:
- Crash when making requests
- Error: âSDK not initializedâ
Solutions:
Initialize early in app lifecycle:
// iOS - In App init or AppDelegate
@main
struct MyApp: App {
init() {
ProtectMyAPI.shared.configure(appId: "app_...")
}
}// Android - In Application class
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
ProtectMyAPI.initialize(this, "app_...")
}
}âSDK version outdatedâ
Symptoms:
- Deprecation warnings
- Features not working
Solutions:
Update to the latest SDK:
// Swift Package Manager
// Update to latest in Xcode: File â Packages â Update to Latest// Gradle
implementation("com.protectmyapi:android-sdk:1.0.0") // Update version# Flutter - pubspec.yaml
dependencies:
protectmyapi: ^1.0.0 # Update to latestDashboard Issues
âCannot create appâ
Solutions:
- Check you have Admin or Owner role
- Verify required fields are filled
- Bundle ID/Package Name must be unique
- Try refreshing the page
âCannot see apps/secretsâ
Solutions:
- Check youâre in the correct organization
- Verify your role has permissions
- Try logging out and back in
- Clear browser cache
âChanges not savingâ
Solutions:
- Check for validation errors
- Refresh the page
- Try a different browser
- Check your internet connection