jh
02/06/2023, 10:38 PMsql
SELECT
*
FROM
http_get ('http://httpbin.org/');
This is runs correctly and quickly.
Now when I run against my edge function:
sql
SELECT
*
FROM
http_get ('https://my-project-id.functions.supabase.co/delete-user-avatar/user-id');
It times out with:
Failed to run sql query: Operation timed out after 5001 milliseconds with 0 bytes received
I've ran it with insomnia and it responds quickly, so I'm not sure what may be going on. Any suggestions?nimo
02/06/2023, 11:07 PMArgument of type 'Omit<UseQueryOptions<TranscriptWithInterview, unknown, TranscriptWithInterview, QueryKey>, "queryKey" | "queryFn">' is not assignable to parameter of type 'Omit<UseQueryOptions<ParserError<"Expected identifier at `\"*\")`">, unknown, TranscriptWithInterview, QueryKey>, "queryKey" | "queryFn">'.
I'm using supabase browser client like so:
const { data: transcript, error } = await supabaseClient
.from('transcript')
.select('*, interview("*")')
.eq('id', tId)
.single();
with react-query. It's erroring with the interview("*")
line, likely because the typescript definitions are confusing it? Any advice on handling this?logemann
02/07/2023, 1:41 AMChez
02/07/2023, 1:43 AMnimo
02/07/2023, 1:46 AMError: Cannot connect to the Docker daemon at
.
1. Is Docker necessary to set this up? Ideally my localhost db points to an environment on Supabase?
2. If yes, is ley
the best alternative? I would rather not rely on docker locally.
3. Will migrations using GH Actions / ley capture changes to RLS, or do those need to be manually duplicated across environments?Pythonic
02/07/2023, 1:51 AMusers
table I have a column role
and I have a function called next_auth.role()
which does the following:
sql
select
coalesce(
nullif(current_setting('request.jwt.claim.role', true), ''),
(nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'role')
)::text
I'm pretty sure this should be working as intended, however I'm getting a strange error after manually giving myself the role supabase_admin
and making a request with the JWT that includes the role
Uncaught (in promise) Error: permission denied to set role "supabase_admin"
Anyone know what this means and how to avoid it?Vince
02/07/2023, 2:07 AMproducts
with product_name
. The id
and created_at
columns are automatically added. I was able to programmatically populate the `products`table with data I got from another source. This is how row insertion is implemented:
const { data, error } = await supabase
.from("prices")
.insert([pricePayload])
.select();
if (error) {
console.log("Cannot insert, see error: ");
console.log(error);
}
if (data) {
console.log("Success!");
console.log(data);
}
Next, I added a table called prices
. Each price belongs to a product but a product can have multiple prices so it references product id as a foreign key. I don't know how to programmatically reference the foreign key when calling the API. Does anyone know how to do this? Is there a reference somewhere I could find?Eryou Hao
02/07/2023, 2:11 AMkhaledg
02/07/2023, 3:18 AMOlly
02/07/2023, 4:11 AMAntDX316
02/07/2023, 6:16 AMJorf
02/07/2023, 7:36 AMlet jams = supabaseClient.from('jams').select('*');
[FILTERS HERE]
jams = jams.order(orderBy, { ascending: asc });
jams = jams.range(startRange, endRange);
const { data: jamsFetched } = await jams;
While there are rows that match the filters, it works properly, but when rows that match the filters run out, it starts fetching rows that don't match the filters. Similar to this question:
https://discord.com/channels/839993398554656828/1017135923298840676/1017135923298840676
The solution there was to add an order. My query has an order. Any ideas on how to get it to stop fetching data that doesn't match the filters?Neelay
02/07/2023, 7:54 AMWD40
02/07/2023, 9:04 AMrequire('dotenv').config()
const { AssetCache } = require("@11ty/eleventy-fetch");
const supabase = require('@supabase/supabase-js').createClient(
process.env.SUPABASE_URL,
process.env.SUPABASE_KEY
)
console.log(supabase);
module.exports = async function () {
let asset = new AssetCache(supabase);
if(asset.isCacheValid("1d")) {
return asset.getCachedValue();
}
try {
// Query the Library table
const libraryTable = await supabase.from('Library').select('*')
// Return the result as a collection
return libraryTable.data
} catch (error) {
// Log the error
console.error(error)
}
}
Any help would be much appreciated. Also note I am happy to hear an alternative to eleventy-fetch too, it was just my first port of call at this stage.blimey
02/07/2023, 9:16 AM[Log] No user (auth.ts, line 10)
[Log] No auth session (auth.ts, line 17)
[Log] Auth State changed – Proxy {access_token: "eyJhbGciOiJIUzI1NiIsInR5cCI6Ik ... …} (app.vue, line 19)
[Log] No user (auth.ts, line 10)
[Log] Got Auth session, user = – {id: "b0a83c5b-4ffd-400d-b751-61ffc2490d72", …} (auth.ts, line 14)
The first No user
and No auth session
are expected, as this is us hitting the login page.
Then the Auth State changed
, this is us hitting Login button.
There is however no user
in the useSupabaseUser
composite. Which there should be, since we just logged in.
This is in auth.ts
on line 10.
The next log line shows us we have an auth session
, which contains the user.
Question is, why is this not in the useSupabaseUser composite?Amara
02/07/2023, 9:30 AMCynicalDuck
02/07/2023, 9:31 AMmattfreire
02/07/2023, 10:08 AMWD40
02/07/2023, 11:12 AMconst EleventyFetch = require("@11ty/eleventy-fetch");
module.exports = async function() {
let url = "https://api.github.com/repos/11ty/eleventy";
/* This returns a promise */
return EleventyFetch(url, {
duration: "1d", // save for 1 day
type: "json" // we’ll parse JSON for you
});
};
What I'm stuck on is how to correctly change that URL to cache Supabase data. According to the documentation, the REST API is available at the following url https://<project_ref>.supabase.co/rest/v1
and this requires the anon
key to be passed through an apiKey
header. How do I actually write this? I have no idea what it means for a URL to have a header. Any help would be much appreciated, thank you.vjoohov
02/07/2023, 12:50 PMReuben
02/07/2023, 1:04 PM?limit=3
and returned payload being ~2kb.
Is this normal and is there a way of speeding this up?lake_mattiato
02/07/2023, 1:09 PMmrmikardo
02/07/2023, 1:15 PMLukas.lwz
02/07/2023, 1:43 PMDaemon
02/07/2023, 2:02 PMj0risnl
02/07/2023, 2:11 PMDisamDev
02/07/2023, 2:47 PMsilentworks
02/07/2023, 3:03 PMoyinkan
02/07/2023, 3:18 PMdrewbie
02/07/2023, 4:12 PMban_duration
in the GoTrue types under AdminUserAttributes
but I cant seem to find a way to set it.
I ultimately want to find a way to be able to suspend bad actors and have it apply to all of my RLS policies that apply to the autheticated user role. Either being able to update their auth role, or set the ban duration seemed to be the best start, but I'm not finding in the docs a way to be able to do either.
Any help is appreciated.
Thanks