-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-supabase.js
More file actions
42 lines (34 loc) · 1.57 KB
/
check-supabase.js
File metadata and controls
42 lines (34 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Simple script to check Supabase storage configuration
const { createClient } = require('@supabase/supabase-js');
const supabaseUrl = 'https://ghkowjxqwxsikrdivwxl.supabase.co';
const supabaseKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imdoa293anhxd3hzaWtyZGl2d3hsIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc0OTkyMjU2NSwiZXhwIjoyMDY1NDk4NTY1fQ.G4KrU8YJlAHZIoG8OyxKDxpx8FDU9yA-9jpvtePYZ3A';
const supabase = createClient(supabaseUrl, supabaseKey);
async function checkSupabaseStorage() {
try {
console.log('Checking Supabase storage buckets...');
const { data: buckets, error } = await supabase.storage.listBuckets();
if (error) {
console.error('Error listing buckets:', error);
return;
}
console.log('Available buckets:', buckets.map(b => b.name));
// Check if source-videos bucket exists
const sourceVideosBucket = buckets.find(b => b.name === 'source-videos');
if (!sourceVideosBucket) {
console.log('The "source-videos" bucket does not exist. Creating it...');
const { data: newBucket, error: createError } = await supabase.storage.createBucket('source-videos', {
public: false
});
if (createError) {
console.error('Error creating source-videos bucket:', createError);
} else {
console.log('Successfully created source-videos bucket:', newBucket);
}
} else {
console.log('The "source-videos" bucket exists:', sourceVideosBucket);
}
} catch (err) {
console.error('Unexpected error:', err);
}
}
checkSupabaseStorage();