Vik
12/23/2022, 2:01 AMDROP FUNCTION IF EXISTS add_onboarding_key();
But that didn't work either.ardyfeb
12/23/2022, 2:39 AMaccessKeyId
secretAccessKey
endpoint
?Hamburger
12/23/2022, 2:45 AMpublic
schema or the auth
schema?${fence}
12/23/2022, 3:11 AMYokoWasis
12/23/2022, 3:51 AMLearningJourney
12/23/2022, 4:00 AMElfhild
12/23/2022, 4:02 AMHege
12/23/2022, 5:18 AMhotbelgo
12/23/2022, 6:47 AMzilchg00d
12/23/2022, 7:57 AMmadsbuch
12/23/2022, 8:26 AMvikramark
12/23/2022, 8:43 AMTaqi
12/23/2022, 10:00 AMillUka
12/23/2022, 11:26 AMTalajax
12/23/2022, 11:33 AMlet result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.All,
allowsEditing: true,
selectionLimit: 1,
aspect: [4, 3],
quality: 1,
});
if (!result.canceled) {
// setImage(result.assets[0]);
const file = result.assets[0];
const response = await fetch(file.uri);
const blob = await response.blob();
try {
const photo = {
uri: file.uri,
type: file.type,
};
const fileExt = photo.uri.split(".").pop();
const filePath = `${Math.random()}.${fileExt}`;
const imageFile = new File([blob], `${Math.random()}`);
let { error } = await supabase.storage
.from("avatars")
.upload(filePath, imageFile);
if (error) {
throw error;
}
} catch (error: any) {
Alert.alert(error.message);
throw new Error();
}
}
CesarNML
12/23/2022, 11:39 AMpremium_content
table to only allow access to profile.is_subscribed = true
it seems that my policy is always evaluating to false
.
Below is the RLS policy on premium_content
table:
sql
(EXISTS ( SELECT profile.id,
profile.created_at,
profile.is_subscribed,
profile."interval",
profile.stripe_customer,
profile.email
FROM profile
WHERE ((uid() = profile.id) AND (profile.is_subscribed = true))))
Below is the current database schema:
ts
export interface Database {
public: {
Tables: {
lesson: {
Row: {
created_at: string | null
description: string | null
id: number
title: string | null
}
}
premium_content: {
Row: {
created_at: string | null
id: number
video_url: string | null
}
}
profile: {
Row: {
created_at: string | null
email: string | null
id: string
interval: string | null
is_subscribed: boolean | null
stripe_customer: string | null
}
}
}
}
I have verified that if I turn off RLS on the premium_content
table the data I want is sent down by supabase. Thank you in advance for any help.Mozes
12/23/2022, 1:30 PMupwell
12/23/2022, 2:35 PM.contains('body:jsonb->>content->>content', ['content->>text: ' + search.value])
lake_mattiato
12/23/2022, 3:00 PMpython
def set_message_read_status_to_true(message_id):
headers = {
'apikey': 'api_key',
'Authorization': f'Bearer apikey'
}
data = '{ "is_read": "true" }'
response = requests.patch(
headers=headers,
params=data,
url=f'https://URL.supabase.co/rest/v1/messages?id=eq.{message_id}'
)
print(f'https://URL.supabase.co/rest/v1/messages?id=eq.{message_id}')
return response.json()
but i get the following response
{'code': 'PGRST102', 'details': None, 'hint': None, 'message': 'Error in $: not enough input'}
Any idea how to solve this?Florian
12/23/2022, 3:22 PMeben
12/23/2022, 4:46 PMjs
await supabase.auth.signUp
function. It sends a mail to the used email that has a link. When users press the link they are just brought back to the "/" route and are forced to Log In using a form to gain access to their account.redwookie
12/23/2022, 5:55 PMHypex
12/23/2022, 6:18 PMjs
import { createClient } from '@supabase/auth-helpers-sveltekit'
export const supabaseClient = createClient(
import.meta.env.VITE_PUBLIC_SUPABASE_URL,
import.meta.env.VITE_PUBLIC_SUPABASE_ANON_KEY,
)
And this .env.local
file:
VITE_PUBLIC_SUPABASE_URL=https://publicurl.supabase.co
VITE_PUBLIC_SUPABASE_ANON_KEY=anonkey
I get this error:
TypeError: Cannot read properties of undefined (reading 'createClient')
at /home/skyfall/Projects/thing/src/lib/db.ts:3:30
at async instantiateModule (file:///home/skyfall/Projects/thing/node_modules/vite/dist/node/chunks/dep-0bae2027.js:52198:9)
How do I get my code to successfully create a client?Rayk0
12/23/2022, 6:57 PMDDupasquier
12/23/2022, 7:28 PMjs
export const screenshotCanvas = (element: string) => {
const el: HTMLElement | null = document.querySelector(element);
if (el) {
html2canvas(el).then((canvas) => {
canvas.toBlob((blob) => {
const file = new File([blob], 'thumbnail.webp', {
type: 'image/webp'
});
console.log(file)
return file;
});
});
}
};
The function which calls the previous function and plugs it into my supabase service:
js
const doScreenshot = () => {
const file: File = screenshotCanvas('.canvas');
uploadThumbnail(file, info.id);
};
The supabase service:
js
export const uploadThumbnail = async (
file: string,
id: number
) => {
const { error } = await supabase.storage
.from('page-screenshots')
.upload(`thumbnail-${id}.webp`, file, {
upsert: true,
contentType: 'image/webp'
});
if (error) {
throw new Error(error.message);
}
};
When I console.log the file, I get a data structure that looks like this:
json
File {name: 'thumbnail.webp', lastModified: 1671822552823, lastModifiedDate: Fri Dec 23 2022 11:09:12 GMT-0800 (Pacific Standard Time), webkitRelativePath: '', size: 23795, …}
lastModified
:
1671822552823
lastModifiedDate
:
Fri Dec 23 2022 11:09:12 GMT-0800 (Pacific Standard Time) {}
name
:
"thumbnail.webp"
size
:
23795
type
:
"image/webp"
webkitRelativePath
:
""
[[Prototype]]
:
File
When I send this data to the db, I get something which resembles a webp, but it's a zero bytes file which contains nothing. I realize that this might not be an actual supabase problem, but maybe someone on here has some insight. I've been messing with this for almost 3 days and I'm losing my mind xDElfhild
12/23/2022, 7:58 PMCreix
12/23/2022, 8:50 PMCrownie
12/23/2022, 9:11 PMjoshtwist
12/23/2022, 9:51 PMapi-key
header in addition to the authorization
header.typeleven
12/23/2022, 10:08 PM