Hal
10/20/2022, 8:36 AMsetAuth
is not available in V2. My code is based on [this issue](https://github.com/supabase/supabase/issues/8490#issuecomment-1219766620). But it returned AuthSessionMissingError: Auth session missing!
. I tried the service role key it's the same result.Ridho
10/20/2022, 10:13 AMjavascript
updateExperience: (id, title, company, detail, startDate, endDate) =>
new Promise((resolve, reject) => {
supabase
.from("experience")
.update({
title,
company,
detail,
start_date: startDate,
end_date: endDate,
})
.eq("id", id)
.then((result) => {
if (!result.error) {
resolve(result);
} else {
reject(result);
}
});
}),
and in controller:
javascript
const result = await experienceModel.updateExperience(
experienceId,
title,
company,
detail,
startDate,
endDate
);
when i log the result:
bash
{
error: null,
data: null,
count: null,
status: 204,
statusText: 'No Content'
}
when i check the table, data is updated but the log didn't show it. i do the same way in my last project, and it was fine.wiesson
10/20/2022, 10:23 AM/dashboard
12:18:47:08
Error: supabaseUrl is required.
at ../../../../node_modules/.pnpm/@supabase+supabase-js@2.0.2/node_modules/@supabase/supabase-js/src/SupabaseClient.ts:87:28
at ../../../../node_modules/.pnpm/@supabase+supabase-js@2.0.2/node_modules/@supabase/supabase-js/src/index.ts:38:9
It seems that the supabase environment var is empty, but it works with the regular functions. Does anyone know what I could do?Afkop-sonneblom
10/20/2022, 11:50 AMfuturmaster
10/20/2022, 1:19 PMmattposgate
10/20/2022, 1:33 PMYelloJello
10/20/2022, 1:38 PMCheqo
10/20/2022, 2:41 PMawait supabaseAdmin.auth.admin.updateUserById(user.id, {
app_metadata: {
role: 'super-premium'
}
I just wanted to know, how to make sure that these changes are reflected immediately in my user token?
is there a method that I can call like auth.refreshToken()
or something like that?simpautus
10/20/2022, 2:52 PMexport function useAuthStateChangeSubscription() {
const fetcher = useFetcher()
const [searchParams] = useSearchParams()
const redirectTo = searchParams.get('redirectTo') ?? ROUTE_HOME
useEffect(() => {
const {
data: { subscription: listener },
} = supabase.auth.onAuthStateChange((event, session) => {
console.log(event)
if (event === 'SIGNED_IN') {
const accessToken = session?.access_token
const refreshToken = session?.refresh_token
if (!accessToken) return
const formData = new FormData()
formData.append('accessToken', accessToken)
formData.append('refreshToken', refreshToken || '')
formData.append('redirectTo', redirectTo)
fetcher.submit(formData, {
method: 'post',
action: '/api/auth/login',
replace: true,
})
}
if (event === 'SIGNED_OUT') {
fetcher.submit(null, {
method: 'post',
action: '/api/auth/logout',
replace: true,
})
}
})
return () => {
listener?.unsubscribe()
}
}, [fetcher, redirectTo])
}
Thoth Trismegistus
10/20/2022, 3:24 PMGreg
10/20/2022, 3:26 PMteiki
10/20/2022, 5:21 PMtyakymiuk
10/20/2022, 5:28 PM*,
likedLocations:locations ??how to specify here to use liked_by_user_locations table?? (
*
),
dislikedLocations:locations ??how to specify here to use disliked_by_user_locations table?? (
*
)
)Lukas V
10/20/2022, 5:58 PM.insert() / .upsert() / .update() / .delete()
methods is not to return any rows.
If I want to check if method was successful, do I have to include .select()
? Because it's seems like otherwise data
will be undefined.
const { data: updateSuccess, error: updateError } = await supabase
.from('users')
.update({
id: user.id,
full_name: "James Bond",
})
if (updateError) {
toast.error('Error updating profile, please try again');
}
if (updateSuccess) {
toast.success('profile updated!');
}
LufyCZ
10/20/2022, 6:19 PMsql
((SELECT count(*) AS count
FROM "lectureSeats" "lectureSeat"
WHERE (("lectureSeat".user_id = uid()) AND ("lectureSeat".lecture = 1))) <= 1)
Problem is, I can't seem to get the ("lectureSeat".lecture = 1)
part right, when I try ("lectureSeat".lecture = lecture)
it just replaces it with ("lectureSeat".lecture = "lectureSeat".lecture )
which is of course always true and doesn't work.
How do I get that newRow.lecture in there?
Thanksstefikira
10/20/2022, 7:37 PMauth.users
to public.users
), but when I'm trying to save it, I get this error ERROR: must be owner of function add_user
. I'm guessing that it has to do with the roles, but I have no idea what to tweak.user8923
10/20/2022, 8:22 PMexport const getServerSideProps = withPageAuth({ redirectTo: '/login' })
withPageAuth
is called with an object that includes the redirectTo
attribute. I need to use the context passed to getServerSideProps
within that attribute, in order to concatenate context.resolvedUrl
to the '/login'
value. How can I do that in the most elegant manner?mumbles
10/20/2022, 8:45 PMczypnt
10/20/2022, 9:22 PMElgr
10/20/2022, 9:43 PMOk-Panda4332
10/21/2022, 4:48 AMcreate policy "Read access."
on storage.objects for select using (
bucket_id = 'bucketname'
and auth.role() = 'anon'
);
URL - https://xyz.supabase.co/storage/v1/object/sign/bucketname/file.txt?token=anonkey
I am having trouble writing SQL command for it.
2. Also if I make my bucket public without any RLS, can others only read the documents or can they edit and upload to the bucket?Xenni
10/21/2022, 5:10 AMupdated_at
or worse role
meaning that we need to store those in entity_meta
tables with read-only permissions.
In doing this though we now are unable to perform sorting since sorting on a foreign table value isn't currently supported with PostgREST afaik.
Am I going crazy or is there a better pattern for these things?Austin
10/21/2022, 5:31 AMimport **type** { NextPage } from 'next'
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
import { useSession, useSupabaseClient } from '@supabase/auth-helpers-react'
const Home: NextPage = () => {
const session = useSession()
const supabase = useSupabaseClient()
return (
<div className="container" style={{ padding: '50px 0 100px 0' }}>
{!session ? (
<Auth
supabaseClient={supabase}
appearance={{ theme: ThemeSupa }}
theme="dark"
/>
) : (
<p>Account page will go here.</p>
)}
</div>
)
}
export default Home
Arne
10/21/2022, 6:17 AMselect graphql.rebuild_schema();
.
Then I try to download the schema using
curl --request GET 'http://localhost:54321/graphql/v1' \
-H 'apikey: eyJhbG...' \
-H 'Authorization: Bearer eyJhbG...'
As result I get:
{
"code": "PGRST202",
"details": null,
"hint": "If a new function was created in the database with this name and parameters, try reloading the schema cache.",
"message": "Could not find the public.graphql() function in the schema cache"
}
Obviously there should be no public.graphql()
function. How should I modify my request to get the GraphQL schema?willsch
10/21/2022, 7:06 AMChi__no
10/21/2022, 7:06 AM//native sign in
GoogleAuth.signIn().then((res) => {
this.supabase.auth
.signIn({
oidc: {
id_token: res.authentication.idToken,
provider: "google",
γγγγγγγγnonce:"some string"
},
})
.then((res) => {
console.log("supabase res");
console.log(res);
});
});
Ansh-Rathod
10/21/2022, 7:26 AMconst { data } = await supabase
.from("Users")
.select("username,hashpass")
.match({ username: req.body.username });
here data is null.
and when i create the table with from supabase ui it works fine!
found something similar issue on github but didn't understand it properly.
https://github.com/supabase/supabase/discussions/5432jkohlin
10/21/2022, 8:39 AMtherakeshpurohit
10/21/2022, 9:20 AMarcavid
10/21/2022, 9:51 AM