bob_the_robot
01/09/2023, 11:38 PMnpm run dev
command I am greeted with this error Any idea what went wrong? Fresh install, only changes and updates are what is in that document.pearcy
01/10/2023, 1:35 AMpepegc
01/10/2023, 1:57 AMasset
with a foreign key (asset_type_id
) that links it to table asset_type
.𝖘𝖚𝖗𝖌𝖎𝖊𝖇𝖔𝖎 | Drooler
01/10/2023, 4:06 AMNADEE_MJ
01/10/2023, 4:07 AMitzomen
01/10/2023, 4:23 AMhonkstyle
01/10/2023, 6:49 AMCREATE TABLE IF NOT EXISTS problems
(
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
statement text not null,
placeholder text not null,
tests text not null,
created_at timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL,
deleted_at timestamptz
);
ALTER TABLE problems enable row level security;
CREATE TABLE IF NOT EXISTS problems_mapping
(
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
problem_id bigint not null,
course_id bigint not null,
section_id bigint,
created_at timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL,
deleted_at timestamptz,
unique(problem_id, course_id, section_id),
FOREIGN KEY(course_id) REFERENCES courses(id) ON DELETE CASCADE,
FOREIGN KEY(section_id) REFERENCES sections(id) ON DELETE CASCADE,
FOREIGN KEY(problem_id) REFERENCES problems(id) ON DELETE CASCADE
);
How do I translate the following query
select p.* from problems as p inner join problems_mapping as pm on p.id = pm.problem_id and pm.course_id = 1;
With the javascript library?iamallin
01/10/2023, 9:04 AMiamallin
01/10/2023, 9:09 AMlake_mattiato
01/10/2023, 9:18 AMimport Stripe from "https://esm.sh/stripe?target=deno";
But getting the following error message when deploying
Bundling create-stripe-customer
Error: Error bundling function: exit status 1
file:///src/index.ts
error: Uncaught (in promise) Error: Relative import path "http" not prefixed with / or ./ or ../
const ret = new Error(getStringFromWasm0(arg0, arg1));
^
at __wbg_new_8d2af00bc1e329ee (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:312:19)
at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:79439)
at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1388039)
at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1862894)
at __wbg_adapter_18 (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:146:6)
at real (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:130:14)
Gitanes
01/10/2023, 10:36 AMhefler
01/10/2023, 11:29 AMsignInWithOtp
(on NodeJS) and it returns AuthRetryableFetchError: {}
. Looking into the auth logs I see the following error:
`
Event Message
running db migrations: error executing migrations/[REDACTED]_modify_users_email_unique_index.up.sql, sql: -- this change is relatively temporary
-- it is meant to keep database consistency guarantees until there is proper
-- introduction of account linking / merging / delinking APIs, at which point
-- rows in the users table will allow duplicates but with programmatic control
alter table only auth.users
add column if not exists is_sso_user boolean not null default false;
comment on column auth.users.is_sso_user is 'Auth: Set this column to true when the account comes from SSO. These accounts can have duplicate emails.';
create unique index if not exists users_email_partial_key on auth.users (email) where (is_sso_user = false);
comment on index auth.users_email_partial_key is 'Auth: A partial unique index that applies only when is_sso_user is false';
alter table only auth.users
drop constraint if exists users_email_key;
: ERROR: cannot drop constraint users_email_key on table users because other objects depend on it (SQLSTATE 2BP01)
I have little understanding of SQL so some help of what's going on and what to do would be much appreciated.anewcar
01/10/2023, 12:16 PMgoldyman
01/10/2023, 12:43 PMdart
supabaseClient
.from('users')
.select<PostgrestListResponse>('id')
.eq('username', userName)
.limit(1)
.single();
and the stacktrace
#0 PostgrestBuilder._parseResponse
package:postgrest/src/postgrest_builder.dart:323
#1 PostgrestBuilder._execute
package:postgrest/src/postgrest_builder.dart:198
<asynchronous suspension>
#2 PostgrestBuilder.then
package:postgrest/src/postgrest_builder.dart:400
<asynchronous suspension>
{
"headers": [
{
"cf_cache_status": "DYNAMIC",
"cf_ray": "78756a92c6578ee0-SOF",
"content_length": null,
"content_location": null,
"content_range": null,
"content_type": "application/vnd.pgrst.object+json; charset=utf-8",
"date": "Tue, 10 Jan 2023 12:29:06 GMT",
"sb_gateway_mode": null,
"sb_gateway_version": "1",
"transfer_encoding": "chunked",
"x_kong_proxy_latency": "0",
"x_kong_upstream_latency": "3"
}
],
"origin_time": 88,
"status_code": 406
}
kresimirgalic
01/10/2023, 2:14 PMCREATE OR REPLACE FUNCTION get_threads_by_user_id(userId uuid)
returns table(id uuid, whom uuid, subject text, user_id uuid, unread_count bigint) AS $$
BEGIN
RETURN QUERY
SELECT threads.id,threads.whom,threads.subject, threads.user_id, COUNT(CASE WHEN threads_message.is_read = false THEN 1 ELSE NULL END) AS unread_count
FROM threads
JOIN threads_message ON threads.id = threads_message.thread_id
WHERE threads.user_id = userId
GROUP BY threads.id;
END;
$$ LANGUAGE plpgsql;
and this is the supabase call with rpc:
const { data, error } = await supabase
.rpc('get_threads_by_user_id', {
userid: userId,
})
.select('*, user_id(*)');
drgonxoo
01/10/2023, 2:14 PMmcdaded
01/10/2023, 2:33 PMsalzar
01/10/2023, 3:28 PMimzino
01/10/2023, 3:48 PManggoran
01/10/2023, 4:11 PMjavascript
const supabase = createClient(supabaseURL!, supabaseServiceRole!, {
auth: {
autoRefreshToken: false,
persistSession: false,
},
global: { headers: { Authorization: req.headers.get("Authorization")! } },
});
const { data: isAdmin }: { data: boolean | null } = await supabase
.rpc("is_admin")
.single();
if (!isAdmin) {
return new Response(
JSON.stringify({ message: "User is not Super Admin." }),
{
headers: { "Content-Type": "application/json" },
status: 403,
}
);
}
const adminAuth = supabase.auth.admin;
const { data: user } = await adminAuth.inviteUserByEmail(email, {
data: {
name: name,
role: role,
super_admin: super_admin,
supporter_id: supporter_id,
},
});
Reuben
01/10/2023, 4:15 PM"remote_addr":"2a06:************"
josephbuchma
01/10/2023, 4:20 PMdocker logs supabase_db_myproject -f
Instead, I see following entries in Postgres container logs :
2023-01-10 10:52:42.450 UTC [47] LOG: redirecting log output to logging collector process
2023-01-10 10:52:42.450 UTC [47] HINT: Future log output will appear in directory "/var/log/postgresql".
Executing SHOW logging_collector
indeed returns "on". So I decided to disable it in the postgresql.conf
, and to my surprise, found out that logging collector is not actually enabled there ( logging_collector = off
in /etc/postgres/logging.conf
file).
I'm confused. Any help is very much appreciated!javierguzman
01/10/2023, 4:56 PMcreate or replace function get_people(radius int, point text, get_all_people boolean)
returns setof profile
language plpgsql
as $$
begin
if get_all_people then
return query select * from profile where id != auth.uid();
else
return query select * from profile where id != auth.uid() and ST_DWithin(location, point::geometry, radius);
end if;
end;
$$;
I have tried to access auth.confirmation_token and stuff like that but it seems that only auth.uid() is available.
Thank you in advance and regardsgoldyman
01/10/2023, 5:00 PMPonku
01/10/2023, 5:32 PMjh
01/10/2023, 5:46 PMjinsley8
01/10/2023, 5:51 PMtext
datatype in their Supabase tables but I thought only the varchar
datatype can be indexed and is much faster?
Any insight on this?ŁukaszW.
01/10/2023, 5:52 PM.select("name, surname, children, code, id:user_id ")
.eq("parent", ctx.user.id);
in the db :
create function children(profiles)
returns jsonb
language plpgsql
security definer
as
$$
begin
return (select array_to_json(array_agg(profile)) from (
select user_id as id, name, surname, code, from profiles where parent = $1.user_id) profile);
end;
$$
I wish just use the function recursively in sub-query but it doesn't work .
Any ideas ?salzar
01/10/2023, 6:50 PMCheqo
01/10/2023, 6:52 PMProperty 'session' does not exist on type 'SupabaseAuthClient'.
export default function App() {
const [session, setSession] = useState<Session | null>(null)
useEffect(() => {
setSession(supabase.auth.session())
supabase.auth.onAuthStateChange((_event, session) => {
setSession(session)
})
}, [])
return (
<View>
{session && session.user ? <Account key={session.user.id} session={session} /> : <Auth />}
</View>
)
}