Alchemy Debug Bundle
Overview
Collect diagnostic data for Alchemy support tickets: connectivity tests, SDK version, network status, CU usage, and recent error logs.
Prerequisites
- A scoped development or sandbox key supplied through a secret store; never
pass the key as a command-line argument or include it in a captured bundle.
- A reproducible issue with the expected network, method, time window, and
sanitized request/correlation ID.
- A review path that checks the bundle for credentials, wallet-address privacy
concerns, or proprietary application data before it leaves the organization.
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
Examples
When a testnet application reports intermittent RPC failures, run the generator
with a scoped development key and inspect the JSON locally. Confirm it reports
SDK version, network status, aggregate latency, and only redacted key state;
remove wallet addresses or application payloads if any were added by local
instrumentation. Attach the sanitized bundle and relevant request ID to a
support ticket. If a bundle exposes a credential or sensitive application
data, do not upload it—revoke the exposed credential if necessary, correct the
redaction logic, and regenerate the evidence.
Error Handling
| Failure |
Response |
| Diagnostic call is unauthorized |
Stop the run and verify the scoped key without printing it. |
| A network check times out |
Record the network and timeout only, then compare against the provider status page. |
| Bundle contains sensitive data |
Quarantine it, rotate any exposed credential, improve redaction, and regenerate. |
| Support needs more context |
Provide sanitized request IDs, timestamps, and SDK version—not application secrets or private keys. |
Resources
Next Steps
For rate limit handling, see alchemy-rate-limits.
1---2name: alchemy-debug-bundle3description: Collect Alchemy SDK debug evidence for troubleshooting and support tickets. Use when encountering persistent issues, preparing support tickets, or debugging blockchain query failures. Trigger: "alchemy debug bundle", "alchemy support ticket", "alchemy diagnostics".4license: MIT5---6# Alchemy Debug Bundle
7
8## Overview
9
10Collect diagnostic data for Alchemy support tickets: connectivity tests, SDK version, network status, CU usage, and recent error logs.
11
12## Prerequisites
13
14- A scoped development or sandbox key supplied through a secret store; never
15 pass the key as a command-line argument or include it in a captured bundle.
16- A reproducible issue with the expected network, method, time window, and
17 sanitized request/correlation ID.
18- A review path that checks the bundle for credentials, wallet-address privacy
19 concerns, or proprietary application data before it leaves the organization.
20
21## Instructions
22
23### Step 1: Debug Bundle Generator
24
25```typescript
26// src/debug/alchemy-debug.ts
27import { Alchemy, Network } from 'alchemy-sdk';
28
29interface DebugBundle {
30 timestamp: string;
31 sdkVersion: string;
32 environment: Record<string, string>;
33 connectivity: Record<string, any>;
34 networkStatus: Record<string, any>;
35}
36
37async function generateDebugBundle(): Promise<DebugBundle> {
38 const alchemy = new Alchemy({
39 apiKey: process.env.ALCHEMY_API_KEY,
40 network: Network.ETH_MAINNET,
41 });
42
43 const bundle: DebugBundle = {
44 timestamp: new Date().toISOString(),
45 sdkVersion: require('alchemy-sdk/package.json').version,
46 environment: {
47 nodeVersion: process.version,
48 platform: process.platform,
49 apiKeySet: process.env.ALCHEMY_API_KEY ? 'yes (redacted)' : 'NO — missing',
50 network: process.env.ALCHEMY_NETWORK || 'ETH_MAINNET',
51 },
52 connectivity: {},
53 networkStatus: {},
54 };
55
56 // Test core connectivity
57 try {
58 const start = Date.now();
59 const blockNumber = await alchemy.core.getBlockNumber();
60 bundle.connectivity.core = {
61 status: 'ok',
62 latencyMs: Date.now() - start,
63 latestBlock: blockNumber,
64 };
65 } catch (err: any) {
66 bundle.connectivity.core = { status: 'failed', error: err.message };
67 }
68
69 // Test Enhanced API
70 try {
71 const start = Date.now();
72 await alchemy.core.getTokenBalances('0x0000000000000000000000000000000000000000');
73 bundle.connectivity.enhancedApi = { status: 'ok', latencyMs: Date.now() - start };
74 } catch (err: any) {
75 bundle.connectivity.enhancedApi = { status: 'failed', error: err.message };
76 }
77
78 // Test NFT API
79 try {
80 const start = Date.now();
81 await alchemy.nft.getContractMetadata('0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D');
82 bundle.connectivity.nftApi = { status: 'ok', latencyMs: Date.now() - start };
83 } catch (err: any) {
84 bundle.connectivity.nftApi = { status: 'failed', error: err.message };
85 }
86
87 // Multi-network status
88 for (const [name, network] of Object.entries({
89 ethereum: Network.ETH_MAINNET,
90 polygon: Network.MATIC_MAINNET,
91 arbitrum: Network.ARB_MAINNET,
92 })) {
93 try {
94 const client = new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network });
95 const block = await client.core.getBlockNumber();
96 bundle.networkStatus[name] = { status: 'ok', block };
97 } catch (err: any) {
98 bundle.networkStatus[name] = { status: 'failed', error: err.message };
99 }
100 }
101
102 const filename = `alchemy-debug-${Date.now()}.json`;
103 require('fs').writeFileSync(filename, JSON.stringify(bundle, null, 2));
104 console.log(`Debug bundle saved: ${filename}`);
105 return bundle;
106}
107
108generateDebugBundle().catch(console.error);
109```
110
111### Step 2: Bash Quick Diagnostic
112
113```bash
114#!/bin/bash
115echo "=== Alchemy Quick Diagnostics ==="
116echo "API Key: ${ALCHEMY_API_KEY:+SET (redacted)}"
117
118echo -n "ETH Mainnet: "
119curl -s "https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" \
120 -X POST -H "Content-Type: application/json" \
121 -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":0}' \
122 | jq -r '.result // .error.message'
123
124echo -n "Polygon: "
125curl -s "https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" \
126 -X POST -H "Content-Type: application/json" \
127 -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":0}' \
128 | jq -r '.result // .error.message'
129
130echo "=== Done ==="
131```
132
133## Output
134
135- JSON debug bundle with connectivity, latency, and network status
136- SDK version and environment configuration
137- Multi-network health check results
138
139## Examples
140
141When a testnet application reports intermittent RPC failures, run the generator
142with a scoped development key and inspect the JSON locally. Confirm it reports
143SDK version, network status, aggregate latency, and only redacted key state;
144remove wallet addresses or application payloads if any were added by local
145instrumentation. Attach the sanitized bundle and relevant request ID to a
146support ticket. If a bundle exposes a credential or sensitive application
147data, do not upload it—revoke the exposed credential if necessary, correct the
148redaction logic, and regenerate the evidence.
149
150## Error Handling
151
152| Failure | Response |
153|---------|----------|
154| Diagnostic call is unauthorized | Stop the run and verify the scoped key without printing it. |
155| A network check times out | Record the network and timeout only, then compare against the provider status page. |
156| Bundle contains sensitive data | Quarantine it, rotate any exposed credential, improve redaction, and regenerate. |
157| Support needs more context | Provide sanitized request IDs, timestamps, and SDK version—not application secrets or private keys. |
158
159## Resources
160
161- [Alchemy Status Page](https://status.alchemy.com)
162- [Alchemy Support](https://www.alchemy.com/support)
163
164## Next Steps
165
166For rate limit handling, see `alchemy-rate-limits`.