anderjaska
09/14/2022, 4:46 PMcreate or replace function public.handle_new_user()
returns trigger as
$$
begin
insert into public."User" (id, email, userType)
values (new.id, new.email, new.raw_user_meta_data->>'user_type');
return new;
end;
$$
language plpgsql security definer;
drop trigger if exists on_auth_user_created on auth.users;
create trigger on_auth_user_created
after insert on auth.users
for each row
execute procedure public.handle_new_user();
But I get a 500 on user signup. I can see the user_type field in the auth panel.
My only guess is that userType
in the User
table is an enum, but I don't know how to cast it properlyEthanxyz
09/14/2022, 5:23 PMhttp://localhost:3000/?error=server_error&error_description=Error+getting+user+email+from+external+provider
error.
All fixes to this issue say that I should obtain elevated status, but the same error is happening even after obtaining elevated status from Twitter.
I am able to send the user to the Twitter Flow, but upon redirect I get the Error+getting+user+email+from+external+provider
error.
Any help would be appreciated.
Edit: Here is some more information. Seems like it works for others. https://github.com/supabase/supabase/discussions/5915anderjaska
09/14/2022, 7:40 PMSonny Vesali
09/14/2022, 8:19 PMrgfx
09/14/2022, 10:04 PMSo I copied the previously created container from /var/lib/docker/
I unable to find the location of the database files to move them into my created folders ./volumes/db/data:/var/lib/postgresql/data
where is my database located?
I don't want to lose my data each time I update.wesleyyue
09/14/2022, 10:25 PMTony_n
09/14/2022, 11:21 PMenti
09/14/2022, 11:40 PMsetAuth()
on our current SupabaseClient Object once we receive the SIGNED_IN
Event with its session.access_token
, or does the SupabaseClient Object updates itself through the signIn()
process?
Asking to be sure because it looks like my API calls still seem to use the anon access token post signIn()hongymagic
09/15/2022, 3:42 AMError querying the database: db error: FATAL: no more connections allowed (max_client_conn)
marcus_polonus
09/15/2022, 5:13 AMAlanK
09/15/2022, 6:25 AMMonkeybanana
09/15/2022, 7:36 AMneoc
09/15/2022, 7:37 AMdoctor_eval
09/15/2022, 7:49 AMimport {createClient} from "@supabase/supabase-js";
let client = createClient(
'http://supabase.example.com/',
'supabase-anon-api-key',
);
const { data, error } = await client.auth.signInWithPassword({
email: 'user@example.com',
password: 'random-password',
})
if (error != null) {
throw error
}
let userinfo = await client
.rpc('userinfo', {})
console.log("Got userinfo", userinfo)
// prints: {
// error: undefined,
// data: { uid: null, role: 'anon' }, <-- this should be role "authenticated"
// count: undefined,
// status: 200,
// statusText: 'OK'
// }
Waldemar
09/15/2022, 8:15 AMavif
09/15/2022, 8:29 AMantimatroid
09/15/2022, 1:32 PMenti
09/15/2022, 2:10 PMcompanies
with RLS enabled.
I created a policy to allow SELECT for any authenticated user + anon.
I do my API call from my Vuejs client with an authenticated user :
js
const { data, error } = await supabase
.from("companies")
.select(
"id, nom, raison, adresse, cp, ville, pays, id_name, uuid, resipay"
);
I check my API call live on the XHR console and the authenticated token is in the header.
Yet I get a 403 response from supabase...
What did I miss?andyjakubowski
09/15/2022, 3:22 PMaccess_token
cookie server-side, for example in Next.js getServerSideProps
via the context.req.cookies
argument. Depending on the existence and validity of the access_token
, I’d like to serve either protected content or redirect the user. But gotrue-js
doesn’t seem to save the cookie on the client automatically. Is there a recommended way to do this?
I noticed that @alaister proposed a new setup for [supabase/auth-helpers
](https://github.com/supabase/auth-helpers/pull/239) where withPageAuth
has the Supabase client read the request/response headers for a cookie and uses that to set a session server side.
But for that cookie to be sent by the browser to my app, say app.vercel.com, I need to first have something save the cookie. The responses from the Supabase Auth API do come with a Set-Cookie
header that holds the access_token
, but the Domain
attribute is set to the Supabase project URL (<xyz>.supabase.co
) — which means this cookie is not passed to my app’s server.
I see two options to address this:
1) Save the cookie on the client in an onAuthStateChange
callback, which will set the cookie’s domain to be the same as the app server. gotrue-js
doesn’t seem to set any cookies on the client, so we’d do that ourselves.
2) Route the login traffic through an API route so that the Set-Cookie
header with an access token comes from my app’s domain.
Am I missing something obvious here? How do you ensure that the access_token
gets passed in the cookie when calling your app server and can be used to set up a session in getServerSideProps
in Next.js, API routes, or in middleware?KickSquare
09/15/2022, 3:36 PMInASunshineState
09/15/2022, 4:13 PM0verread
09/15/2022, 4:15 PMProtoFeather
09/15/2022, 4:28 PMcur.execute(f"INSERT INTO mydb (model, img, multi_dl) VALUES ('{model}', '{img}', '{multi_dl}'); NOTIFY test, 'placeholder';")
I'd like the placeholder to be the operation I just executed (intert into...). Any ideas?Wonie
09/15/2022, 4:41 PMAron
09/15/2022, 6:06 PMsteezli
09/15/2022, 6:25 PMlewisd
09/15/2022, 7:22 PMorders
.
An order can have many lineItems
. As I'm coming from firebase, I would just usually have an order
document. It would have an orderTotal
field.
The lineItems
would also be part of this order
document.
However, now that my db is relational and split into tables, is it best practice to store totals like I have done before or should I calculate the total price when selecting all my lineItems
?najjannaj
09/15/2022, 7:46 PMsupabase.functions.invoke<Blob>('createInvoice', {
body: { invoiceId: invoiceId }
}).then(res => FileSaver.save(res.data))
Best regards,
Janpocin
09/15/2022, 8:16 PMpg_dumpall
my prod instance.
Running
supabase start
pg_restore -cC -d postgres -e ./postgres.custom
gives
pg_restore: from TOC entry 3540; 1262 12974 DATABASE postgres postgres
pg_restore: error: could not execute query: ERROR: cannot drop the currently open database
When i psql
and
create database temp;
\c temp;
drop database postgres with (force);
I get
ERROR: database "postgres" is used by an active logical replication slot
DETAIL: There is 1 active slot.
but pg_subscription
is empty.
How can i restore a database from a backup?louisstephensca
09/15/2022, 8:44 PM