nahtnam
01/28/2023, 9:26 AMstripe-sync-engine
for my project and noticed that the init script did not create a schema. I tried creating one with the following in the web UI:
CREATE SCHEMA IF NOT EXISTS stripe;
GRANT USAGE ON SCHEMA stripe TO postgres;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA stripe TO postgres;
but now I'm getting this error: Error: Migration failed. Reason: permission denied for schema stripe
Any ideas why?nahtnam
01/28/2023, 10:12 AMcustomer_id
into profiles
table
3. Create a subscription through my app
4. stripe-sync-engine will auto capture through the webhook the status
What now? I think if I had premium content, I can add a RLS lock that cross references that the customer has an active subscription? What if in my app I would like to get a boolean if the user is subscribed or not? Do I need to make a trigger to sync the customers state into the profiles table? Seems kind of cumbersome, any way I can add a computed column or view or make my stripe
schema public to supabase (but secured via RLS)?ehesp
01/28/2023, 10:30 AMEinar Persson
01/28/2023, 12:12 PMid
, name
(text) and title
(text)
I have marked the columns as not nullable, and I verified in the UI that it prevented me from creating a new row if name or title was absent.
However, I also noticed that I via the javascript-client was able to insert empty strings.
My question is simply: Is it possible to prevent empty strings from being accepted as valid values, similar to not being null?SandySeagull
01/28/2023, 1:18 PMImposer
01/28/2023, 1:40 PMlogemann
01/28/2023, 1:42 PMKuba
01/28/2023, 2:50 PMFailed to create hook: failed to create pg.triggers: schema "supabase_functions" does not exist
I enabled PG_NET
and created schema supabase_functions
, but then I got following error:
Failed to create hook: failed to create pg.triggers: function supabase_functions.http_request() does not exist
I stumbled upon this discussion on GitHub: https://github.com/supabase/supabase/discussions/6966, but the extensions
is already in path. Adding pg_temp
doesn't solve the issue either.
Enabling HTTP
extension for extensions
or previously created supabase_functions
doesn't work.
PS.: The UX in this section is cumbersome. Clicking on the popup to copy the error text dismisses the menu for hook creation.Eidur
01/28/2023, 4:19 PMbewfra
01/28/2023, 5:06 PMSELECT "getcategorychildren"('cat_3c9193d0b2a451f57f64692a0b87c70f')
2. I copied the code from the docs to invoke the function from my JS client like:
let { data, error } = await supabase
.rpc('getcategorychildren', {
category_id_initial: 'cat_3c9193d0b2a451f57f64692a0b87c70f'
})
if (error) console.error(error)
else console.log(data)
It returns null
. Other queries work just fine. I am using the SECRET_KEY
right now since its server side.
What could be the issue?
It worked shortly before, I then changed the function - just changed the name to be honest - and ever since its just null
Trixrabbit
01/28/2023, 5:39 PMgetServerSession()
when getSupabase()
almost does the same thing but returns the session + the client.
In the docs they use getServerSession()
to return the session in the +layout.server.ts
and getSupabase()
in the +layout.ts
... Can someone help me understand why it doesn't use getSupabase()
in the +layout.server.ts
also ? Thanksegonschiele
01/28/2023, 6:24 PMJaaneek
01/28/2023, 7:27 PMAntDX316
01/28/2023, 7:54 PMAntDX316
01/28/2023, 8:27 PMGKL
01/28/2023, 9:03 PMrhythm493
01/28/2023, 9:46 PMAntDX316
01/28/2023, 10:06 PMAntDX316
01/28/2023, 10:36 PMAltDan
01/28/2023, 11:53 PMsupabase gen types
command to generate some types based on my database.
Id like to add types to the companies state variable, however it seems long winded to import this from the lib/database.types.ts
file.
For example:
import { Database } from './lib/database.types';
const [companies, setCompanies] = useState<Database['public']['Tables']['companies']['Row'][]>([]);
Is there a neater way to achieve this?Unknown Member
01/29/2023, 1:12 AMdogedogego
01/29/2023, 2:43 AMrchrdnsh
01/29/2023, 4:33 AMsql
create function increment (row_id int)
returns void as
$$
update ads
set views = views + 1
where id = row_id;
$$
language sql volatile
;
...that is supposed to update one of the row fields...
...in my sveltekit app I do this:
html
<script>
import { supabase } from '$library/supabase/supabaseClient';
function updateViews() {
const { data, error } = supabase.rpc("increment", { row_id: 1 });
console.log(`This function ran! I swear`);
};
</script>
<div
class='ad'
use:inview
on:enter={() => {
updateViews();
views++;
console.log(`views: `, views);
console.log(`entered`);}
}
>
... the ad and stuff...
</div>
...and all the stuff works when the inview action fires, except I am not seeing the views value increment in the database, so it's not working somehow...
...it seems like everything is working in the sveltkit part, so I figure the sql function is messed up, I just don't know how to fix it...fabianuribe
01/29/2023, 5:04 AMCross-Origin-Resource-Policy: cross-origin
on Storage assets in order to support Cross-Origin Embedder Policy (https://web.dev/coop-coep/)
It appears that there is currently no support for setting custom headers for Storage in Production (https://github.com/supabase/storage-api/issues/216#issuecomment-1324759684)
Is there any way to add this header to the storage response without having to add an intermediary such as a reverse-proxy?stu
01/29/2023, 6:23 AMts
const { data, error } = (await supabase
.from("devices")
.insert({
name,
manufacturer,
})
.select()) as { data: DeviceRow[]; error: PostgrestError | null };
And the details for the failed insert look like Key (name)=(Tempest) already exists.pmembrey
01/29/2023, 6:26 AMuser_profile
example, there is a field username
. I don't want users to be able to change their usernames, even though I am fine with them changing (for example) the display name.
Similarly, if I store a customer_id
for user with Stripe, I don't really want the user to be able to see that, and certainly not be able to edit it.
I would expect this is a fairly common scenario for APIs, so I imagine I'm missing something, but I would greatly appreciate being pointed in the right direction 🙂
Thanks!Adi
01/29/2023, 10:15 AMWizzel
01/29/2023, 11:14 AMJ0rdan
01/29/2023, 12:01 PM