stillmotion
01/02/2023, 8:30 PMPythonic
01/02/2023, 8:31 PMts
const PROJECT_URL = "***";
const PUBLIC_KEY = "***";
const PRIVATE_KEY = process.env.SUPABASE_KEY;
export const supabase_admin = createClient(PROJECT_URL, PRIVATE_KEY || '');
export const supabase_client = createClient(PROJECT_URL, PUBLIC_KEY);
ts
import { supabase_client } from "@/lib/supabase";
import { FaGoogle } from "react-icons/fa";
export default function GoogleLogin() {
const signIn = async () => {
const { data, error } = await supabase_client.auth.signInWithOAuth({
provider: 'google',
})
}
return (
...
);
}
However when I import both of them into my projet is get a Error: supabaseKey is required.
bob_merlin
01/02/2023, 9:40 PMmigra
or the standart command, the `trigger`'s created in the UI will not be in the migrationsAndrewww
01/02/2023, 11:58 PManggoran
01/03/2023, 1:52 AMUncaught (in promise) Error: Module not found "npm:js2xmlparser@5.0.0".
It seems that Supabase use Deno Deploy. From what I've seen in Deno discord channel, it doesn't support npm package. Is there any alternative on this?Esore
01/03/2023, 1:54 AM'use client'
import type {NextPage} from "next"
import {useUser, useSupabaseClient} from "@supabase/auth-helpers-react"
import {Auth, ThemeSupa} from "@supabase/auth-ui-react"
import {useRouter} from "next/navigation"
const Login:NextPage = () => {
const supabaseClient = useSupabaseClient();
const user = useUser();
const router = useRouter();
if(user) {
router.push('/dashboard')
}
return (
<Auth appearance={{theme: ThemeSupa}} supabaseClient={supabaseClient} />
)
}
export default Login
This is my login page. What could be leading to this error? Thanks!Tony_n
01/03/2023, 3:05 AMmickey
01/03/2023, 3:37 AMjdgamble555
01/03/2023, 4:06 AMCaleb
01/03/2023, 4:26 AMmembers_teams
with id, team_id, user_id, created_at
and a table teams
with id, team_name, created_at
. When i join them and return the product i get errors because there's multiple instances of id
. What would be a good solution here? I was searching for3 or 4 hours last night and can't seem to find a solid answer. I would just SELECT the records and return them with RETURN NEXT
but supabase throws and error that has only one discussion from some random article in 2003 saying materialize mode required, but it is not allowed in this context
So if anyone knows the answer to that..
sql
create or replace view r as select
members_teams.*,
teams.created_at as teams_created_at,
teams.id as teams_id,
teams.team_name as teams_team_name,
accounts.id as accounts_id,
accounts.full_name as accounts_full_name,
accounts.created_at as accounts_created_at,
accounts.profile_picture as accounts_profile_picture,
accounts.public_profile as accounts_public_profile,
accounts.user_id as accounts_user_id,
accounts.username as accounts_username
FROM members_teams
JOIN teams on members_teams.team_id = teams.id
JOIN accounts on members_teams.account_id = accounts.user_id
where members_teams.user_id = auth.uid();
CREATE OR REPLACE FUNCTION handle_new_team(team_name text)
RETURNS r
AS
$$
DECLARE
_team_id uuid;
data record;
BEGIN
insert into teams (team_name)
values (team_name)
returning id into _team_id;
insert into members_teams (team_id, user_id, team_manager, member_role, account_id)
values (_team_id, auth.uid(), true, 'Team Manager', auth.uid());
select * into data FROM r where r.team_id = _team_id;
return data;
END;
$$
LANGUAGE plpgsql;
This is the function for referencerinorzk
01/03/2023, 6:37 AMJb
01/03/2023, 7:23 AMMaceDogg
01/03/2023, 7:53 AMCrownie
01/03/2023, 9:01 AMsql
-- Delete image after post is deleted
CREATE OR REPLACE FUNCTION delete_image() RETURNS TRIGGER AS $$
DECLARE
image_path text;
BEGIN
-- Get the image path for the post being deleted
SELECT public.posts.image_path INTO image_path FROM public.posts;
-- Delete the image from the post-images bucket
delete from storage.objects where bucket_id = 'post-images' and name = image_path;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
-- Create a trigger that calls the delete_image function after a post is deleted
CREATE TRIGGER delete_image_when_postdelete
AFTER DELETE ON posts
FOR EACH ROW
EXECUTE PROCEDURE delete_image();
I think this is more of a postgresql problem but is there like an easy way to do this?flapili (FR, bad EN)
01/03/2023, 9:03 AMJerry X
01/03/2023, 9:18 AMD3R1K
01/03/2023, 9:22 AMsilentworks
01/03/2023, 11:50 AMdavidvic02
01/03/2023, 11:35 AM49Ryann
01/03/2023, 1:20 PMsupabase secrets list
sylar815
01/03/2023, 1:37 PMflapili (FR, bad EN)
01/03/2023, 1:56 PMosgm
01/03/2023, 2:15 PMlocal config differs from linked project
right after supabase link
.
Full output:
Finished supabase link.
Local config differs from linked project. Try updating supabase/config.toml
[api]
port = 54321
schemas = ["public", "storage", "graphql_public"]
extra_search_path = ["public", "extensions"]
max_rows = 1000
oskar@MacBook-Pro-2 test-backend % supabase db remote commit
Error: The remote database's migration history is not in sync with the contents of supabase/migrations. Resolve this by:
- Updating the project from version control to get the latest supabase/migrations,
- Pushing unapplied migrations with supabase db push,
- Or failing that, manually editing supabase_migrations.schema_migrations table with supabase migration repair.
Try rerunning the command with --debug to troubleshoot the error.
oskar@MacBook-Pro-2 test-backend % git add .
fatal: not a git repository (or any of the parent directories): .git
This is a fresh project, the only thing I've done is add two buckets using the DashboardRares | Foton • Teeps
01/03/2023, 2:34 PMdatasource db {
provider = "postgresql"
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model Extension {
id String @id @default(cuid())
}
.env:
DATABASE_URL=postgres://aaa:aaa@db.xxx.supabase.co:6543/postgres?pgbouncer=true&connection_limit=1
SHADOW_DATABASE_URL=postgres://aaa:aaa@db.xxx.supabase.co:6543/postgres_shadow
when i run js
prisma migrate dev --name init
i get
Error: db error: FATAL: bouncer config error
0: migration_core::state::DevDiagnostic
at migration-engine/core/src/state.rs:264
KennStack01
01/03/2023, 2:34 PMbrassotron
01/03/2023, 2:42 PMhttp_header
function outside the body of the function, if I try to call this inside the function body I get the following error?
function http_header(unknown, unknown) does not exist
Is it because of the language set on the function?
Thanks,
Connordexsnake
01/03/2023, 3:27 PMcurrent transaction is aborted, commands ignored until end of transaction block
when using the v2 javascript library in my react native project.
I can't seem to track down the issue as it happens randomly in any function that calls the api, inserts, selects etc.
When the error is thrown, there is no details or hint on the error object. Just a 25P02 code and that message.salym_akhmedov
01/03/2023, 3:43 PM/board?id=eq.${id}&select=*
);
};twonarly
01/03/2023, 3:44 PMselect * from rentalequipment where to_tsvector(title)
@@ to_tsquery('Hilti');
returning the correct data, but my postgresql.graphql file is not written correctly. Currently this is what I have getRentalequipmentByTerm(term: String): [Rentalequipment]
@dbquery(
type: "postgresql"
schema: "public"
query: """
SELECT * from rentalequipment where to_tsvector(title)
@@ to_tsquery('$1');
"""
configuration: "postgresql_config"
)
logemann
01/03/2023, 3:57 PMimport { UserResponse } from '@supabase/gotrue-js/src/lib/types';
const foo = () : Promise<UserResponse> => {
const supabase = createServerClient();
return supabase.auth.admin.inviteUserByEmail("some@email.com");
}
It complains about Promise but when i look into the supabase code, i see this very return type. Anyone else facing this issue?
original error message:
> TS2322: Type 'Promise' is not assignable to type 'Promise'. Type 'import("/Users/ml/development/projects/nextjs/with-tailwindcss-app/node_modules/@supabase/gotrue-js/dist/module/lib/types").UserResponse' is not assignable to type 'import("/Users/ml/development/projects/nextjs/with-tailwindcss-app/node_modules/@supabase/gotrue-js/src/lib/types").UserResponse'.