SKILL.md
Apollo Debug Bundle
Current State
!node --version 2>/dev/null || echo 'N/A'
!python3 --version 2>/dev/null || echo 'N/A'
!uname -a
Overview
Collect comprehensive debug information for Apollo.io API issues. Generates a JSON diagnostic bundle with environment info, connectivity tests, rate limit status, key type verification, and sanitized request/response logs.
Prerequisites
APOLLO_API_KEYenvironment variable set- Node.js 18+ or Python 3.10+
Instructions
Step 1: Create the Debug Bundle Collector
// src/scripts/debug-bundle.ts
import axios from 'axios';
import os from 'os';
const BASE_URL = 'https://api.apollo.io/api/v1';
interface DebugBundle {
timestamp: string;
environment: Record<string, string>;
connectivity: { reachable: boolean; latencyMs: number; statusCode?: number };
keyType: 'master' | 'standard' | 'invalid' | 'unknown';
rateLimits: { limit?: string; remaining?: string; window?: string };
endpointTests: Array<{ endpoint: string; status: number | string; ok: boolean }>;
systemInfo: Record<string, string>;
}
async function collectDebugBundle(): Promise<DebugBundle> {
const headers = {
'Content-Type': 'application/json',
'x-api-key': process.env.APOLLO_API_KEY ?? '',
};
const bundle: DebugBundle = {
timestamp: new Date().toISOString(),
environment: {
nodeVersion: process.version,
platform: os.platform(),
arch: os.arch(),
apiKeySet: process.env.APOLLO_API_KEY ? 'yes (redacted)' : 'NOT SET',
apiKeyLength: String(process.env.APOLLO_API_KEY?.length ?? 0),
apiKeyPrefix: process.env.APOLLO_API_KEY?.slice(0, 4) + '...' ?? 'N/A',
},
connectivity: { reachable: false, latencyMs: 0 },
keyType: 'unknown',
rateLimits: {},
endpointTests: [],
systemInfo: {},
};
return bundle;
}
Step 2: Test Connectivity and Key Type
async function testConnectivity(bundle: DebugBundle) {
const headers = { 'Content-Type': 'application/json', 'x-api-key': process.env.APOLLO_API_KEY! };
// Test basic auth
const start = Date.now();
try {
const resp = await axios.get(`${BASE_URL}/auth/health`, { headers, timeout: 10_000 });
bundle.connectivity = { reachable: true, latencyMs: Date.now() - start, statusCode: resp.status };
bundle.keyType = resp.data.is_logged_in ? 'standard' : 'invalid'; // at minimum standard
} catch (err: any) {
bundle.connectivity = { reachable: false, latencyMs: Date.now() - start, statusCode: err.response?.status };
return;
}
// Test master key access
try {
await axios.post(`${BASE_URL}/contacts/search`, { per_page: 1 }, { headers, timeout: 10_000 });
bundle.keyType = 'master';
} catch (err: any) {
if (err.response?.status === 403) bundle.keyType = 'standard';
}
}
