jarnold
03/15/2023, 12:49 PMconst { data, error } = await supabaseClient.storage.getBucket("test");
This gives a status code 200 but no results. The bucket is there, has images in it and is public. I'm new to this so maybe it's policy related or config. related. Hoping that it's not a bug in the local env.joeally
03/15/2023, 12:53 PMunknown
is generated for table types by the types generator (issue: https://github.com/supabase/postgres-meta/issues/534). My PR is at https://github.com/supabase/postgres-meta/pull/533 and it's a pretty small change so it shouldn't be too hard to review.
I appreciate that you're all busy and this might not be the highest priority but I just thought I'd ask anyway.
Thanksdmayo2
03/15/2023, 1:38 PM"asupabase/supabase-is": "^2.10.0"
, with GET and POST to update a table with RLS. I have my sb-db-auth-token
in my localStorage.
Then suddenly I start getting CORS error of Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
Reading lots, but just can't figure out why it started, let alone how to solve it now.
I plan to host my app on Netlify. I guess I could use a CORS browser extension during development, but that just sounds counter intuitive to me. If I have to setup a server(less) function on Netlify, A). I have no clue how to do that and haven't found a good tutorial.
Am I correct in my thinking that the supabase.co server should be handling requests correctly? Did I change something in my code? Did I change something in my supabase dashboard?
Since they didn't answer thought I should come here. Comments/Thoughts/Suggestions would all be greatly appreciated.49Ryann
03/15/2023, 1:54 PMcreate view all_conversations_view WITH (security_invoker) as
SELECT
c.id,
c.conversation_sid,
c.last_message,
CASE
WHEN ct.mobile IS NOT NULL THEN json_build_object('id', ct.id, 'full_name', ct.full_name, 'name', ct.name, 'surname', ct.surname, 'profile_image', ct.profile_image, 'phone', ct.phone, 'mobile', ct.mobile)
ELSE NULL
END AS contact,
CASE
WHEN u.id IS NOT NULL THEN json_build_object('id', u.id, 'full_name', u.full_name, 'name', u.name, 'surname', u.surname, 'profile_image', u.profile_image, 'phone', u.phone, 'mobile', u.mobile)
ELSE NULL
END AS user,
CASE
WHEN o.id IS NOT NULL THEN json_build_object('id', o.id, 'twilio_phone_number', o.twilio_phone_number)
ELSE NULL
END AS organisation
FROM conversations c
INNER JOIN organisations o ON c.organisation_id = o.id
INNER JOIN users u ON c.user_id = u.id
LEFT JOIN contacts ct ON c.contact_mobile = ct.mobile AND c.organisation_id = ct.organisation_id;
If you notice on the left join on the very bottom I'm finding a mobile number match & ensuring organisation_id is equal, is this necessary to do the organisation_id check if I already have RLS enabled on that contacts table?
It's possible two different organisations have a contact with the same mobile, I also have an index to ensure organisation_id & mobile is unique.louis030195
03/15/2023, 2:00 PMchrtravels
03/15/2023, 2:17 PMconst updates = {
id: user.id,
username,
website,
avatar_url,
updated_at: new Date().toISOString(),
}
let { error } = await supabase.from('profiles').upsert(updates)
So I tried this method with update, where "id" column matches id:
let { error } = await supabase
.from('profiles')
.update({username, full_name: fullName, website, avatar_url, bio, banner_img_url})
.eq("id", id)
I can tell it does try to post something. The refresh spins on Supabase and I get no errors in the console but the name doesn’t update, as if nothing was submitted for full_name. However I console.log full_name right before submission and it does have the correct value.
Now I did create “supabase” from “@supabase/supabase-js” instead of auth-helpers but don’t think that should be a problem.ewic
03/15/2023, 2:20 PMauth
of supabase for flutter but on nextjs i will use next-auth
.
to lessen creating a backend server for both platform. Sorry i'm still new with supabase. Thank you for response 🙏chrtravels
03/15/2023, 3:22 PMexport async function getPosts(val, equals, equalTo) {
let { data: posts, error } = await supabase
.from('posts')
.select(val)
.eq(equals, equalTo)
return posts;
}
I did try to use "or" for filtering but not exactly sure how to make that work. For example in the case where the equality check is to see if the id matches the current user.
https://supabase.com/docs/reference/javascript/or
Thanks!Derock
03/15/2023, 4:42 PM2023-03-15T15:37:56: PM2 log: Launching in no daemon mode
2023-03-15T15:37:56: PM2 log: App [server:0] starting in -fork mode-
2023-03-15T15:37:56: PM2 log: App [server:0] online
running migrations
Error: getaddrinfo ENOTFOUND supatest_db
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'supatest_db'
}
running nslookup in the container works finekvnfo
03/15/2023, 5:03 PMandrijan
03/15/2023, 5:11 PMacho01
03/15/2023, 5:24 PMdev Joakim Pedersen
03/15/2023, 6:16 PMCOPY (
SELECT *
FROM product_table_prod_v2
WHERE store_id = 193
) TO 'storage/buckets/csv' WITH CSV HEADER;
but neither 'storage/buckets/csv' works it gives me invalid SQL query.
or storage.buckets.csv either, then I get an error at or near storage. since it expects a string.
Is this possible to do?chrtravels
03/15/2023, 6:45 PMexport async function getImage(bucket, imageName) {
const { data } = await supabase
.storage
.from(bucket)
.getPublicUrl(imageName)
return data;
}
Then retrieving with:
const banner = await getImage('banner-images', `${session.user.id}.jpg`).then(data => data.publicUrl);
That returns this format:
https://myurl/storage/v1/object/public/banner-images/image-that-doesnt-exist.jpg▾
edgaras
03/15/2023, 6:52 PM(auth.uid() = profile_id)
only VS. also targeting authenticated
role via dropdown?sudoramen
03/15/2023, 7:48 PMBizzare
03/15/2023, 8:01 PMkuba
03/15/2023, 8:07 PMdart
await ref.read(authRepositoryProvider).auth.**api**.updateUser(
jwt,
UserAttributes(password: password),
);
But after supabase package update I can't use auth.api
dart
await ref.read(authRepositoryProvider).auth.updateUser(
// No jwt field in updateUser().
UserAttributes(password: password),
);
mansedan
03/15/2023, 8:55 PMnateland
03/15/2023, 9:11 PMFetch
and Insert
, but not Update
.
Thoughts?robertn702
03/15/2023, 9:16 PMoidc: expected audience "{ServiceID}" got ["{AppBundleID}"]
I am using `expo-apple-authentication`'s AppleAuthentication.signInAsync()
to get the idToken, which seems to work fine. Then passing the token to supabase.auth.signInWithTokenId({ provider: "apple", token: idToken })
throws the error.
I've followed these instructions[0], but I'm wondering if there is a difference in setup between using Sign in with Apple on the web vs native. Supabase's docs don't cover usage with native apps it seems. 😕
[0]: https://supabase.com/docs/guides/auth/social-login/auth-applenateland
03/15/2023, 9:17 PMgoldyman
03/15/2023, 9:29 PMzszszsz
03/15/2023, 11:21 PMwith check
and for insert has no using
.
Eg. in [this part of the doc](https://supabase.com/docs/guides/auth/row-level-security#restrict-updates) it writes
sql
create policy "Users can update their own profiles."
on profiles for update using (
auth.uid() = id
)
Would it be better to
sql
create policy "Users can update their own profiles."
on profiles for update using (
auth.uid() = id
) with check (
auth.uid() = id
)
Besides if it is for insert
or for all
but inserting to the table, is the using
just skipped and only the with check
condition is applied to the inserted row ? So generally if it is a for all
you may just repeat using
condition in with check
again ?𝙲𝚑𝚞𝚞𝚔
03/15/2023, 11:50 PMasync function _signUp() {
const { user, session, error } = await supaClient.auth.signUp({
email: document.getElementById('email').value,
password: document.getElementById('cPassword').value,
})
}
function signUp() {
function fail() {
console.log('invalid password or username')
}
if (document.getElementById('cPassword').value < 8) {
fail();
return;
}
if (document.getElementById('email').value == '') {
fail();
return;
}
_signUp().then(
function(value) {
document.getElementById('form').style.visibility = "hidden";
document.getElementById('succ').style.visibility = "visible";
},
function(error) {console.log('?')}
)
}
async function _signIn() {
let { data, error } = await supaClient.auth.signInWithPassword({
email: document.getElementById('userID').value,
password: document.getElementById('password').value
})
}
function signIn() {
function fail() {
console.log('invalid password or username')
}
_signIn().then(
function(value) {window.location.href = "app/dashboard.html";},
function(error) {console.log('?'); fail();}
)
}
async function _signOff() {
let { error } = await supaClient.auth.signOut()
}
function signOff() {
_signOff().then(
function(value) {window.location.href = "/";},
function(error) {console.log('?')}
)
}
function token() {
let urll = window.location.href;
if (urll.includes("#access_token")) {
window.location.href = "app/dashboard.html";
}
}
brubadger
03/16/2023, 1:18 AMkingpeppe
03/16/2023, 2:39 AMts
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
import type { Database } from './types/supabase'
// // SETTINGS
const SUPABASE_URL = Deno.env.get('SUPABASE_URL')
const SUPABASE_KEY = Deno.env.get('SUPABASE_KEY')
// CLIENT
export const supabase = createClient<Database>(SUPABASE_URL, SUPABASE_KEY)
ts
export const getStats = async () => {
const { data: swap-stats, error } = await supabase.from('swap-stats').select('*')
if (data) return data
if (error) return error
}
however, I keep getting errors. What am I doing wrong?BrianVueReference
03/16/2023, 2:47 AMkingpeppe
03/16/2023, 2:47 AMsupabase.ts
ts
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'
import type { Database } from './types/supabase'
// // SETTINGS
const SUPABASE_URL = Deno.env.get('SUPABASE_URL')
const SUPABASE_KEY = Deno.env.get('SUPABASE_KEY')
// CLIENT
export const supabase = createClient<Database>(SUPABASE_URL, SUPABASE_KEY)
// HELPERS
export const getStats = async () => {
const { data, error } = await supabase.from('swap-stats').select('*')
if (data) return data
if (error) return error
}
main.ts
ts
import { getStats } from './supabase.ts'
const stats = await getStats()
console.log(stats)
What am I doing wrong?dmayo2
03/16/2023, 2:52 AM