Alchemy Debug Bundle
Overview
Collect diagnostic data for Alchemy support tickets: connectivity tests, SDK version, network status, CU usage, and recent error logs.
Instructions
Step 1: Debug Bundle Generator
// src/debug/alchemy-debug.ts
import { Alchemy, Network } from 'alchemy-sdk';
interface DebugBundle {
timestamp: string;
sdkVersion: string;
environment: Record<string, string>;
connectivity: Record<string, any>;
networkStatus: Record<string, any>;
}
async function generateDebugBundle(): Promise<DebugBundle> {
const alchemy = new Alchemy({
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET,
});
const bundle: DebugBundle = {
timestamp: new Date().toISOString(),
sdkVersion: require('alchemy-sdk/package.json').version,
environment: {
nodeVersion: process.version,
platform: process.platform,
apiKeySet: process.env.ALCHEMY_API_KEY ? 'yes (redacted)' : 'NO — missing',
network: process.env.ALCHEMY_NETWORK || 'ETH_MAINNET',
},
connectivity: {},
networkStatus: {},
};
// Test core connectivity
try {
const start = Date.now();
const blockNumber = await alchemy.core.getBlockNumber();
bundle.connectivity.core = {
status: 'ok',
latencyMs: Date.now() - start,
latestBlock: blockNumber,
};
} catch (err: any) {
bundle.connectivity.core = { status: 'failed', error: err.message };
}
// Test Enhanced API
try {
const start = Date.now();
await alchemy.core.getTokenBalances('0x0000000000000000000000000000000000000000');
bundle.connectivity.enhancedApi = { status: 'ok', latencyMs: Date.now() - start };
} catch (err: any) {
bundle.connectivity.enhancedApi = { status: 'failed', error: err.message };
}
// Test NFT API
try {
const start = Date.now();
await alchemy.nft.getContractMetadata('0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D');
bundle.connectivity.nftApi = { status: 'ok', latencyMs: Date.now() - start };
} catch (err: any) {
bundle.connectivity.nftApi = { status: 'failed', error: err.message };
}
// Multi-network status
for (const [name, network] of Object.entries({
ethereum: Network.ETH_MAINNET,
polygon: Network.MATIC_MAINNET,
arbitrum: Network.ARB_MAINNET,
})) {
try {
const client = new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network });
const block = await client.core.getBlockNumber();
bundle.networkStatus[name] = { status: 'ok', block };
} catch (err: any) {
bundle.networkStatus[name] = { status: 'failed', error: err.message };
}
}
const filename = `alchemy-debug-${Date.now()}.json`;
require('fs').writeFileSync(filename, JSON.stringify(bundle, null, 2));
console.log(`Debug bundle saved: ${filename}`);
return bundle;
}
generateDebugBundle().catch(console.error);
Step 2: Bash Quick Diagnostic
#!/bin/bash
echo "=== Alchemy Quick Diagnostics ==="
echo "API Key: ${ALCHEMY_API_KEY:+SET (redacted)}"
echo -n "ETH Mainnet: "
curl -s "https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" \
-X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":0}' \
| jq -r '.result // .error.message'
echo -n "Polygon: "
curl -s "https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" \
-X POST -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":0}' \
| jq -r '.result // .error.message'
echo "=== Done ==="
Output
- JSON debug bundle with connectivity, latency, and network status
- SDK version and environment configuration
- Multi-network health check results
Resources
Next Steps
For rate limit handling, see alchemy-rate-limits.
1---2name: alchemy-debug-bundle3description: |4 Collect Alchemy SDK debug evidence for troubleshooting and support tickets.5 Use when encountering persistent issues, preparing support tickets,6 or debugging blockchain query failures.7 Trigger: "alchemy debug bundle", "alchemy support ticket", "alchemy diagnostics".8allowed-tools: Read, Write, Edit, Bash(curl:*), Bash(node:*), Grep9version: 1.0.010license: MIT11author: Jeremy Longshore <jeremy@intentsolutions.io>12tags: [saas, blockchain, web3, alchemy, debugging]13compatible-with: claude-code14---1516# Alchemy Debug Bundle1718## Overview1920Collect diagnostic data for Alchemy support tickets: connectivity tests, SDK version, network status, CU usage, and recent error logs.2122## Instructions2324### Step 1: Debug Bundle Generator2526```typescript27// src/debug/alchemy-debug.ts28import { Alchemy, Network } from 'alchemy-sdk';2930interface DebugBundle {31 timestamp: string;32 sdkVersion: string;33 environment: Record<string, string>;34 connectivity: Record<string, any>;35 networkStatus: Record<string, any>;36}3738async function generateDebugBundle(): Promise<DebugBundle> {39 const alchemy = new Alchemy({40 apiKey: process.env.ALCHEMY_API_KEY,41 network: Network.ETH_MAINNET,42 });4344 const bundle: DebugBundle = {45 timestamp: new Date().toISOString(),46 sdkVersion: require('alchemy-sdk/package.json').version,47 environment: {48 nodeVersion: process.version,49 platform: process.platform,50 apiKeySet: process.env.ALCHEMY_API_KEY ? 'yes (redacted)' : 'NO — missing',51 network: process.env.ALCHEMY_NETWORK || 'ETH_MAINNET',52 },53 connectivity: {},54 networkStatus: {},55 };5657 // Test core connectivity58 try {59 const start = Date.now();60 const blockNumber = await alchemy.core.getBlockNumber();61 bundle.connectivity.core = {62 status: 'ok',63 latencyMs: Date.now() - start,64 latestBlock: blockNumber,65 };66 } catch (err: any) {67 bundle.connectivity.core = { status: 'failed', error: err.message };68 }6970 // Test Enhanced API71 try {72 const start = Date.now();73 await alchemy.core.getTokenBalances('0x0000000000000000000000000000000000000000');74 bundle.connectivity.enhancedApi = { status: 'ok', latencyMs: Date.now() - start };75 } catch (err: any) {76 bundle.connectivity.enhancedApi = { status: 'failed', error: err.message };77 }7879 // Test NFT API80 try {81 const start = Date.now();82 await alchemy.nft.getContractMetadata('0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D');83 bundle.connectivity.nftApi = { status: 'ok', latencyMs: Date.now() - start };84 } catch (err: any) {85 bundle.connectivity.nftApi = { status: 'failed', error: err.message };86 }8788 // Multi-network status89 for (const [name, network] of Object.entries({90 ethereum: Network.ETH_MAINNET,91 polygon: Network.MATIC_MAINNET,92 arbitrum: Network.ARB_MAINNET,93 })) {94 try {95 const client = new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network });96 const block = await client.core.getBlockNumber();97 bundle.networkStatus[name] = { status: 'ok', block };98 } catch (err: any) {99 bundle.networkStatus[name] = { status: 'failed', error: err.message };100 }101 }102103 const filename = `alchemy-debug-${Date.now()}.json`;104 require('fs').writeFileSync(filename, JSON.stringify(bundle, null, 2));105 console.log(`Debug bundle saved: ${filename}`);106 return bundle;107}108109generateDebugBundle().catch(console.error);110```111112### Step 2: Bash Quick Diagnostic113114```bash115#!/bin/bash116echo "=== Alchemy Quick Diagnostics ==="117echo "API Key: ${ALCHEMY_API_KEY:+SET (redacted)}"118119echo -n "ETH Mainnet: "120curl -s "https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" \121 -X POST -H "Content-Type: application/json" \122 -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":0}' \123 | jq -r '.result // .error.message'124125echo -n "Polygon: "126curl -s "https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" \127 -X POST -H "Content-Type: application/json" \128 -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":0}' \129 | jq -r '.result // .error.message'130131echo "=== Done ==="132```133134## Output135136- JSON debug bundle with connectivity, latency, and network status137- SDK version and environment configuration138- Multi-network health check results139140## Resources141142- [Alchemy Status Page](https://status.alchemy.com)143- [Alchemy Support](https://www.alchemy.com/support)144145## Next Steps146147For rate limit handling, see `alchemy-rate-limits`.148