Spaces:
Runtime error
Runtime error
Commit ·
6be128e
1
Parent(s): 26e13ff
docs: Add troubleshooting guide for cloud deployment issues and solutions
Browse files- README.md +4 -0
- src/features/discovery/docs/troubleshooting.md +132 -0
README.md
CHANGED
|
@@ -22,6 +22,10 @@ Vault is an AI-powered platform that transforms YouTube video archives into shop
|
|
| 22 |
- **Background Jobs**: Inngest for AI discovery pipeline
|
| 23 |
- **Deployment**: Vercel (Frontend) + Railway (Workers)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
## Getting Started
|
| 26 |
|
| 27 |
### Prerequisites
|
|
|
|
| 22 |
- **Background Jobs**: Inngest for AI discovery pipeline
|
| 23 |
- **Deployment**: Vercel (Frontend) + Railway (Workers)
|
| 24 |
|
| 25 |
+
## Troubleshooting
|
| 26 |
+
|
| 27 |
+
For detailed information about cloud deployment issues and solutions, see the [Troubleshooting Guide](src/features/discovery/docs/troubleshooting.md).
|
| 28 |
+
|
| 29 |
## Getting Started
|
| 30 |
|
| 31 |
### Prerequisites
|
src/features/discovery/docs/troubleshooting.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Cloud Deployment Troubleshooting & Findings
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
|
| 5 |
+
This document captures the key challenges, solutions, and learnings from troubleshooting the cloud deployment of the Vault AI video processing system. The findings are based on debugging the YouTube video processing pipeline in a Hugging Face Space deployment environment.
|
| 6 |
+
|
| 7 |
+
## Problem Analysis
|
| 8 |
+
|
| 9 |
+
### Initial Symptom
|
| 10 |
+
The system was failing to process YouTube videos with vague error messages. The process would appear to start but would either hang or return empty results without any meaningful error information.
|
| 11 |
+
|
| 12 |
+
### Root Cause Analysis
|
| 13 |
+
|
| 14 |
+
#### Major Finding: DNS Resolution Failure (ENOTFOUND)
|
| 15 |
+
|
| 16 |
+
**Issue:** The system was failing to resolve domain names (youtube.com and img.youtube.com) with the error:
|
| 17 |
+
```
|
| 18 |
+
[Errno -5] No address associated with hostname
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
**Root Cause:**
|
| 22 |
+
The Hugging Face Space deployment environment was experiencing IPv6 network configuration issues. The free tier environment was having difficulty resolving DNS queries over IPv6, which caused failures when attempting to connect to YouTube APIs.
|
| 23 |
+
|
| 24 |
+
**Verification:**
|
| 25 |
+
- Detailed logs showed consistent DNS resolution failures
|
| 26 |
+
- The issue was reproducible in multiple deployment attempts
|
| 27 |
+
- Network connectivity tests confirmed the IPv6 configuration problem
|
| 28 |
+
|
| 29 |
+
## Solution Implemented
|
| 30 |
+
|
| 31 |
+
### Fix: Forcing IPv4 Connections
|
| 32 |
+
|
| 33 |
+
The solution involves forcing all network connections to use IPv4 instead of IPv6. This was implemented in two critical components:
|
| 34 |
+
|
| 35 |
+
#### 1. yt-dlp Configuration
|
| 36 |
+
Modified the yt-dlp command to include the `--force-ipv4` flag:
|
| 37 |
+
|
| 38 |
+
```javascript
|
| 39 |
+
// fly-server/server.js
|
| 40 |
+
const downloadVideo = async (videoUrl) => {
|
| 41 |
+
return new Promise((resolve, reject) => {
|
| 42 |
+
const tempDir = os.tmpdir();
|
| 43 |
+
const filename = `video_${Date.now()}`;
|
| 44 |
+
const outputPath = path.join(tempDir, `${filename}.%(ext)s`);
|
| 45 |
+
|
| 46 |
+
// Force IPv4 for yt-dlp
|
| 47 |
+
const command = `yt-dlp --force-ipv4 -o "${outputPath}" "${videoUrl}"`;
|
| 48 |
+
exec(command, (error, stdout, stderr) => {
|
| 49 |
+
if (error) {
|
| 50 |
+
console.error('yt-dlp error:', stderr);
|
| 51 |
+
reject(new Error(`yt-dlp failed: ${stderr}`));
|
| 52 |
+
return;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
// Find downloaded file
|
| 56 |
+
const files = fs.readdirSync(tempDir);
|
| 57 |
+
const videoFile = files.find(f => f.startsWith(filename));
|
| 58 |
+
if (!videoFile) {
|
| 59 |
+
reject(new Error('Video file not found after download'));
|
| 60 |
+
return;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
resolve(path.join(tempDir, videoFile));
|
| 64 |
+
});
|
| 65 |
+
});
|
| 66 |
+
};
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
#### 2. axios HTTP Client Configuration
|
| 70 |
+
Added IPv4 forcing configuration to the axios HTTP client:
|
| 71 |
+
|
| 72 |
+
```javascript
|
| 73 |
+
// fly-server/server.js
|
| 74 |
+
const axiosInstance = axios.create({
|
| 75 |
+
timeout: 30000,
|
| 76 |
+
headers: {
|
| 77 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
|
| 78 |
+
},
|
| 79 |
+
// Force IPv4 resolution
|
| 80 |
+
httpAgent: new http.Agent({ family: 4 }),
|
| 81 |
+
httpsAgent: new https.Agent({ family: 4 })
|
| 82 |
+
});
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
## Deployment Verification
|
| 86 |
+
|
| 87 |
+
### Testing Process
|
| 88 |
+
1. Applied the IPv4 forcing fix to the server.js file
|
| 89 |
+
2. Deployed the updated version to Hugging Face Space
|
| 90 |
+
3. Waited for the container to rebuild and start
|
| 91 |
+
4. Executed a manual trigger to test video processing
|
| 92 |
+
5. Verified results and monitored system behavior
|
| 93 |
+
|
| 94 |
+
### Results
|
| 95 |
+
- DNS resolution failures eliminated
|
| 96 |
+
- YouTube video downloads now succeed consistently
|
| 97 |
+
- Video processing pipeline works as expected
|
| 98 |
+
- System stability improved significantly
|
| 99 |
+
|
| 100 |
+
## Lessons Learned
|
| 101 |
+
|
| 102 |
+
### 1. Network Environment Considerations
|
| 103 |
+
Free tier cloud environments (like Hugging Face Spaces) often have limitations or configuration issues with IPv6 connectivity. Always test for both IPv4 and IPv6 compatibility when deploying network-dependent applications.
|
| 104 |
+
|
| 105 |
+
### 2. Logging and Debugging
|
| 106 |
+
Detailed error logging is critical for troubleshooting vague failures. The initial issue was challenging to diagnose because the system was not providing specific error information about the DNS resolution failure.
|
| 107 |
+
|
| 108 |
+
### 3. Fallback Mechanisms
|
| 109 |
+
Implementing robust fallback logic for network operations is essential. The system now includes:
|
| 110 |
+
- Multiple extraction methods (yt-dlp as primary, fallback HTTP methods)
|
| 111 |
+
- Detailed error logging for each failure scenario
|
| 112 |
+
- Retry mechanisms for transient network issues
|
| 113 |
+
|
| 114 |
+
### 4. Container Configuration
|
| 115 |
+
When running applications in containerized environments:
|
| 116 |
+
- Always test DNS resolution within the container
|
| 117 |
+
- Consider network restrictions and configuration options
|
| 118 |
+
- Monitor container logs for early detection of issues
|
| 119 |
+
|
| 120 |
+
## Ongoing Monitoring
|
| 121 |
+
|
| 122 |
+
The system now includes enhanced monitoring to detect and respond to network issues:
|
| 123 |
+
- Real-time logging of DNS resolution attempts
|
| 124 |
+
- Metrics for network connectivity success rates
|
| 125 |
+
- Alerting for repeated network failures
|
| 126 |
+
- Performance monitoring of video processing pipeline
|
| 127 |
+
|
| 128 |
+
## Conclusion
|
| 129 |
+
|
| 130 |
+
The cloud deployment issue was successfully resolved by forcing IPv4 connections. This fix addresses the underlying DNS resolution failure caused by IPv6 network configuration problems in the free tier Hugging Face Space environment.
|
| 131 |
+
|
| 132 |
+
**Key Takeaway:** Network connectivity issues in cloud environments often require specific configuration changes rather than code fixes. Understanding the deployment environment's network constraints is crucial for building reliable applications.
|