Raffael-Kultyshev commited on
Commit
f791e9c
·
verified ·
1 Parent(s): 0b43131

Fix: Add HF_TOKEN to fetchParquetFile for 401 error on parquet files

Browse files
Files changed (1) hide show
  1. src/utils/parquetUtils.ts +10 -1
src/utils/parquetUtils.ts CHANGED
@@ -52,7 +52,16 @@ export function formatStringWithVars(
52
 
53
  // Fetch and parse the Parquet file
54
  export async function fetchParquetFile(url: string): Promise<ArrayBuffer> {
55
- const res = await fetch(url);
 
 
 
 
 
 
 
 
 
56
 
57
  if (!res.ok) {
58
  throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);
 
52
 
53
  // Fetch and parse the Parquet file
54
  export async function fetchParquetFile(url: string): Promise<ArrayBuffer> {
55
+ // Get token from environment (set in Space secrets)
56
+ const hfToken = process.env.HF_TOKEN;
57
+ const headers: HeadersInit = {};
58
+
59
+ // Add Authorization header if token is available
60
+ if (hfToken) {
61
+ headers["Authorization"] = `Bearer ${hfToken}`;
62
+ }
63
+
64
+ const res = await fetch(url, { headers });
65
 
66
  if (!res.ok) {
67
  throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);