ย ยทย App boss

Supabase bucket returning [] when it was working fine a few days ago.

Database & APIs

Project custom action was returning the name of the requested file fine a few days ago, now is not working and returning: 'Listing files error' (on the browser Network tab -> Response shows as [] Status Code: 200 ๐Ÿ˜Ÿ I am using the version of the project at the point when everything was working fine, although wha I needed was to get a list of String names for the files I also was having trouble making that code but well, tha is another issue.

My bucket has this policy for all:

(bucket_id = 'test-tool-store'::text)

Thank you in advance to the awesome and smart coders ๐Ÿ˜ƒ

// Automatic FlutterFlow imports

import '/backend/schema/structs/index.dart';

import '/backend/supabase/supabase.dart';

import '/flutter_flow/flutter_flow_theme.dart';

import '/flutter_flow/flutter_flow_util.dart';

import '/custom_code/actions/index.dart'; // Imports other custom actions

import '/flutter_flow/custom_functions.dart'; // Imports custom functions

import 'package:flutter/material.dart';

// Begin custom action code

// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import 'package:storage_client/src/types.dart';

Future<String> getPdfList() async {

try {

final folderName = 'pdfs';

if (folderName == null) {

throw 'Error: folder does not exist as given';

}

final searchOptions = SearchOptions(

sortBy: SortBy(column: 'name', order: 'desc'),

);

final response = await SupaFlow.client.storage

.from('test-tool-store')

.list(path: 'folderName', searchOptions: searchOptions);

if (response.isNotEmpty) {

final files = response.first;

final fileURL = files.name;

return fileURL;

} else {

return 'Listing files error';

}

} catch (error) {

return 'Error: $error';

}

}

What have you tried so far?

Checked Supabase and Flutterflow docs. Googled the Google and check stackoverflow. Took a vacation to Paradise Valley. Still not working.

Did you check FlutterFlow's Documentation for this topic?
Yes
2
5 replies