Dynamic Intelligence
commited on
Commit
·
e612ce5
1
Parent(s):
00a956c
Fix 401 error: Add authenticated API proxy for private datasets
Browse files
src/app/api/hf-proxy/route.ts
CHANGED
|
@@ -39,13 +39,13 @@ async function handleRequest(request: NextRequest, method: 'GET' | 'HEAD') {
|
|
| 39 |
const envKeys = Object.keys(process.env).filter(k =>
|
| 40 |
k.includes('HF') || k.includes('TOKEN') || k.includes('HUGGING')
|
| 41 |
);
|
| 42 |
-
console.error('
|
| 43 |
console.error('Checked: HF_TOKEN, HUGGINGFACE_TOKEN, HF_API_TOKEN, HUGGING_FACE_HUB_TOKEN');
|
| 44 |
console.error('Available env vars with HF/TOKEN:', envKeys.length > 0 ? envKeys.join(', ') : 'NONE');
|
| 45 |
console.error('⚠️ Requests to private repos will fail with 401');
|
| 46 |
console.error('💡 Make sure HF_TOKEN secret is added in Space Settings → Variables and secrets');
|
| 47 |
} else {
|
| 48 |
-
console.log('
|
| 49 |
}
|
| 50 |
|
| 51 |
try {
|
|
|
|
| 39 |
const envKeys = Object.keys(process.env).filter(k =>
|
| 40 |
k.includes('HF') || k.includes('TOKEN') || k.includes('HUGGING')
|
| 41 |
);
|
| 42 |
+
console.error('HF_TOKEN not found!');
|
| 43 |
console.error('Checked: HF_TOKEN, HUGGINGFACE_TOKEN, HF_API_TOKEN, HUGGING_FACE_HUB_TOKEN');
|
| 44 |
console.error('Available env vars with HF/TOKEN:', envKeys.length > 0 ? envKeys.join(', ') : 'NONE');
|
| 45 |
console.error('⚠️ Requests to private repos will fail with 401');
|
| 46 |
console.error('💡 Make sure HF_TOKEN secret is added in Space Settings → Variables and secrets');
|
| 47 |
} else {
|
| 48 |
+
console.log('HF_TOKEN found (length:', token.length, 'chars, starts with:', token.substring(0, 5) + '...)');
|
| 49 |
}
|
| 50 |
|
| 51 |
try {
|