nateland
03/22/2023, 3:53 PMremaining
. But then I get a notification to upgrade my instance. What on earth is going on?rbravo
03/22/2023, 4:44 PMAri
03/22/2023, 4:58 PMNokorbis
03/22/2023, 5:38 PMts
const fileName = profile.user_id + '/avatar' + extension;
let { data: storageData, error: storageError } = await supabase.storage
.from('avatars')
.upload(fileName, file, { upsert: true });
The response :
json
{"statusCode":"403","error":"","message":"new row violates row-level security policy for table \"objects\""}
I've checked all the storage policies but I don't get what isn't working.
First there was a check on the authenticated
role and the folder name, but I've set everything to true and still nothings work.
The avatars
bucket is a public one.
I'm logged in as a user and I'm using Sveltekit + Auth UI helper.
Does anyone see what is wrong ?sudoramen
03/22/2023, 5:48 PMjopfre
03/22/2023, 7:54 PMshiftkeyisbroke
03/22/2023, 7:57 PMpg-boss
, but not sure how easy that will be to set up in Supabase's Postgres instance.Clariityy
03/22/2023, 8:11 PMimport { createServerSupabaseClient } from "@supabase/auth-helpers-nextjs";
...
const supabase = createServerSupabaseClient(
{
req,
res,
},
{
supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL,
supabaseKey: process.env.SUPABASE_SERVICE_KEY,
}
);
On execution I'm still getting the error: new row violates row-level security policy for table "users"
genesisisamazing
03/22/2023, 8:16 PM.User.Identity.IsAuthenticated
always returns false.
if I change AuthenticationStateProvider in AuthService.cs to CustomAuthStateProvider, it can authenticate but then the pages can't detect it so returns unauthenticated.
builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthStateProvider>(
provider => new CustomAuthStateProvider(
provider.GetRequiredService<ILocalStorageService>(),
provider.GetRequiredService<Supabase.Client>(),
provider.GetRequiredService<ILogger<CustomAuthStateProvider>>()
)
);
vexkiddy
03/22/2023, 8:23 PMlet builder = supabaseInit.from('drops').select(`*,
collectibles (*),
attendance (*, profile(*)),
profile ( profile, profileImage )
`)
How would we limit the results / rows of the foreign table attendance
in the above example ?coop
03/22/2023, 8:25 PMimport 'server-only'
to server files seemed to help partially but thats confusing because I thought all app folder things are default server side
- Wondering if its a key issue for a public database?MusashiGarami
03/22/2023, 8:28 PMmostly_harmless
03/22/2023, 9:19 PMgoldyman
03/22/2023, 9:48 PMdart
class GiftsRealtimeBloc extends Bloc<GiftsRealtimeEvent, GiftsRealtimeState> {
GiftsRealtimeBloc({
required SupabaseClient supabaseClient,
}) : _supabaseClient = supabaseClient,
super(GiftsRealtimeState.initial()) {
on<UpdateData>(_onUpdateData);
channel = _supabaseClient.channel('public:gifts');
channel.on(
RealtimeListenTypes.postgresChanges,
ChannelFilter(event: 'INSERT', schema: 'public', table: 'gifts'),
(payload, [ref]) {
log(payload.toString());
log(ref.toString());
add(UpdateData(payload as List<Map<String, dynamic>>));
},
).subscribe();
}
final SupabaseClient _supabaseClient;
late final RealtimeChannel channel;
void _onUpdateData(
UpdateData event,
Emitter<GiftsRealtimeState> emit,
) {
emit(state.copyWith(data: event.data));
}
@override
Future<void> close() async {
await _supabaseClient.removeChannel(channel);
return super.close();
}
}
the callback never fires
dart
(payload, [ref]) {
log(payload.toString());
log(ref.toString());
add(UpdateData(payload as List<Map<String, dynamic>>));
},
I'm sure the channel is instantiated.mansedan
03/22/2023, 10:21 PMsql
CREATE OR REPLACE FUNCTION find_event_by_team(
team_name TEXT,
event_time TIMESTAMP,
sport_name TEXT
)
RETURNS SETOF events%ROWTYPE AS $$
BEGIN
RETURN QUERY
SELECT e.*
FROM events e
INNER JOIN sports s ON e.sport_id = s.sport_id
INNER JOIN teams t1 ON e.away_team = t1.team_id
INNER JOIN teams t2 ON e.home_team = t2.team_id
WHERE e.date_event = event_time
AND s.sport_name = sport_name
AND CONCAT(t1.name, ' ', t1.mascot, ' @ ', t2.name, ' ', t2.mascot) = team_name;
END;
$$ LANGUAGE plpgsql;
When I go to create this I get the following error:
> Failed to validate sql query: syntax error at or near "%"heedongcho-xyz
03/23/2023, 12:04 AMmaglev
03/23/2023, 12:12 AMconst { data, error } = await supabase
.from('contacts')
.select()
.in('id', ['id1', 'id2', 'id3'])
are the results returned guaranteed to be in the order of [id1, id2, id3] and if not is there a way to returned the ordered results? Thanks.baocin
03/23/2023, 12:53 AMBoogersLLC
03/23/2023, 3:03 AMx
- x_users
x
has any arbitrary values which would be shared 1-to-many-users
To determine if x
can be seen by someone other than it's owner, it must exist in x_users
Thus, important columns in x_users
are
- x_id
- user_id
So to SELECT x
where you have a user
sql
(EXISTS ( SELECT 1 FROM x_users WHERE ((x_users.x_id = x.id) AND (auth.uid() = x_users.user_id))))
to see x_users
where you can see x
sql
(EXISTS ( SELECT 1 FROM x WHERE (x.id = x_users.x_id)))
You end up with an infinitely recursive pair of RLS rules. How could I adjust my structure to:
- Allow users access to a row in x
- Allow other users to see what x_users
have access to that row in x
Sniped137
03/23/2023, 4:17 AMJinx
03/23/2023, 4:28 AMsam the monkey
03/23/2023, 5:17 AMclotho_dataset
.
I've wrapped my _app.tsx
in a supabase SessionContextProvider
component and I've passed in my supabaseClient
(created using my SB key and SB endpoint url).
Then, in a child component I tried to access my SB client like so:
1. I create a variable const supabaseContext = useSessionContext()
.
2. I get my SB client as: const supabaseClient = supabaseContext.supabaseClient as SupabaseClient;
.
In the next line I get my error: console.log(supabaseClient.from("clotho_dataset").select("*"));
The error shown in chrome is: TypeError: supabaseClient.from is not a function
.
I'm inexperienced with Next.js and supabase, any help as to whats going is appreciated. Thank you!rajamaka
03/23/2023, 5:28 AMTiago
03/23/2023, 7:22 AMconst calculatePMT = (rate, nper, pv, fv) => {
let pmt, pvif;
fv || (fv = 0);
if (rate === 0) return (pv + fv) / nper;
pvif = Math.pow(1 + rate, nper);
pmt = (rate * (pv * pvif + fv)) / (pvif - 1);
return pmt;
};
export default calculatePMT;
All the existing variables are stored on supabase.
What would be the best approach to make this calculation on supabase?
Thank you for the helpArdaBasoglu
03/23/2023, 9:59 AMSELIM HÜR
03/23/2023, 11:38 AMboeledi
03/23/2023, 11:39 AMBEGIN
PERFORM http((
'POST',
'https://<ref>.functions.supabase.co/ef_send_email',
ARRAY[http_header('Authorization','Bearer <ANON.PUBLIC KEY>')],
'text/plain',
'{"user_id": ' || NEW.user_id || '}'
)::http_request);
RETURN NEW;
END;
From the logs, I see that the invocation arrives at the level of the Edge Functions, but as soon as I am launching a query, such as:
const { data, error } = await supabaseClient
.from("t_user")
.select()
.eq('user_id', user_id )
.maybeSingle();
I have NO errors, but data is null.
From the logs (API Edge Network), I see a status code 406.
Any help more than welcome.
Many thanks in advance,Sheepii
03/23/2023, 12:03 PMTalajax
03/23/2023, 12:04 PMdynamic streamWorkoutExercises(String division) {
String query = '''*
, exercise:exercise (*)
''';
return supabase
.from('workout_exercises')
.stream(primaryKey: ['id']).select(query).eq('division', division);
}
But i can't use select when streaming. How should i do it?NanoBit
03/23/2023, 12:17 PM