Troubleshooting
Common issues and solutions for the LegionEdge Platform
This guide covers common issues you may encounter when working with the LegionEdge Platform and how to resolve them.
Authentication Errors
401 Unauthorized: "authentication_failed"
Cause: The API key or access token is invalid, expired, or revoked.
Solution:
- Verify the key is correct and has not been revoked in the dashboard.
- Check that you are using the right key for the environment (live vs. test).
- For OAuth tokens, check if the token has expired and refresh it.
import { AuthenticationError } from "@legionedge/sdk";
try {
await client.auth.whoami();
} catch (err) {
if (err instanceof AuthenticationError) {
console.error("API key is invalid. Generate a new one in the dashboard.");
}
}403 Forbidden: "insufficient_permissions"
Cause: The authenticated user or API key lacks the required permissions.
Solution:
- Check the scopes on your API key:
client.apiKeys.get(keyId). - Verify your role in the organization or project.
- Ask an organization admin to grant the necessary permissions.
API Errors
429 Too Many Requests
Cause: You have exceeded the rate limit for your plan.
Solution:
- Check the
Retry-Afterheader and wait before retrying. - Enable automatic retries in the SDK:
const client = new LegionEdge({
apiKey: process.env.LEGIONEDGE_API_KEY!,
retries: { maxRetries: 3 },
rateLimiting: { enabled: true, strategy: "adaptive" },
});- Consider upgrading your plan if you consistently hit limits.
422 Validation Error
Cause: The request body contains invalid data.
Solution: Check the error response for field-level details:
try {
await client.projects.create({ name: "" });
} catch (err) {
if (err instanceof LegionEdgeError && err.code === "validation_error") {
// err.details contains field-level errors
for (const field of err.details) {
console.error(`${field.path}: ${field.message}`);
}
}
}500 Internal Server Error
Cause: An unexpected error on the platform side.
Solution:
- Retry the request. The SDK retries 500-series errors automatically if retries are enabled.
- If the error persists, check the status page for ongoing incidents.
- Contact support with the
requestIdfrom the error response.
Deployment Failures
Deployment Stuck in "building" Status
Possible causes:
- Build dependencies are failing to install.
- The build script is hanging.
Solution:
- Check the deployment logs:
const logs = await client.deployments.getLogs("deploy_abc123");
console.log(logs);- Verify your build command works locally.
- Check for missing environment variables or secrets.
Deployment Fails on Health Check
Cause: The application is not responding on the configured health check path.
Solution:
- Ensure your application exposes the health check endpoint (default:
/health). - Verify the health check configuration:
const deployment = await client.deployments.get("deploy_abc123");
console.log("Health check config:", deployment.healthCheck);- Check application logs for startup errors.
SDK Issues
"Module not found" After Installation
Solution: Ensure you are using a supported Node.js version (18+) and your tsconfig.json has the correct moduleResolution setting:
{
"compilerOptions": {
"moduleResolution": "bundler"
}
}TypeScript Type Errors
Solution: Ensure you are using TypeScript 5.0+ and have installed the latest SDK version:
npm update @legionedge/sdkPerformance Issues
Slow API Responses
- Enable SDK-level caching for read-heavy workloads.
- Use field selection to reduce payload sizes.
- Check your network latency to
api.legionedge.com.
curl -w "Connect: %{time_connect}s\nTotal: %{time_total}s\n" -o /dev/null -s \
https://api.legionedge.com/v2/healthNext Steps
- Browse the FAQ for answers to common questions.
- Contact support for issues not covered here.