Hieu Vu
04/20/2023, 3:01 PMauthService.loginWith(Email) {
this.email = email
this.password = password
}
How I provide GoTrue:
createSupabaseClient(
supabaseUrl = BuildConfig.SUPABASE_URL,
supabaseKey = BuildConfig.API_KEY
) {
install(Postgrest)
install(GoTrue)
}
catico
04/20/2023, 3:35 PMhooks.server.ts
is null.Vadorequest
04/20/2023, 3:48 PMhttps://cdn.discordapp.com/attachments/1098636215122673754/1098636215357546536/image.png▾
DignifiedSwine
04/20/2023, 4:18 PMdaniromo
04/20/2023, 4:28 PMhttps://cdn.discordapp.com/attachments/1098646500499787908/1098646500818567258/image.png▾
kpradel
04/20/2023, 4:58 PMcreate or replace function hello_world()
returns trigger
language plpgsql
as $$
begin
WITH userprofile AS (
insert into public.userprofile (userid, email)
values (new.id, new.email)
returning userid
),
accounts AS (
insert into public.accounts (ownerid)
select userprofile.userid from userprofile
returning id
)
insert into public.accounts_users (userid, accountid)
select userprofile.userid, accounts.id from userprofile, accounts;
return new;
end;
$$;
In the SQL editor I get confirmation that the function ran successfully. But when I sign up as a new user, I get
Database error saving new user". Please help. This is beyond frustrating...bombillazo
04/20/2023, 5:36 PMdeploy
, I get errors. I am on the latest version of the CLI. If I run supabase functions deploy test
I get the folowing error:
sh
Deploying supabase function: test
Version 1.30.3 is already installed
Bundling test
Error: Error bundling function: exit status 1
file:///src/import_map.json
file:///src/index.ts
file:///_shared/supabase.client.ts
file:///services/users/user.service.ts
file:///util/format.types.ts
error: Uncaught (in promise) Error: NotFound: No such file or directory (os error 2)
const ret = new Error(getStringFromWasm0(arg0, arg1));
^
at __wbg_new_8d2af00bc1e329ee (https://deno.land/x/eszip@v0.35.0/eszip_wasm.generated.js:513:19)
at <anonymous> (https://deno.land/x/eszip@v0.35.0/eszip_wasm_bg.wasm:1:1559899)
at <anonymous> (https://deno.land/x/eszip@v0.35.0/eszip_wasm_bg.wasm:1:1398157)
at <anonymous> (https://deno.land/x/eszip@v0.35.0/eszip_wasm_bg.wasm:1:1895031)
at __wbg_adapter_40 (https://deno.land/x/eszip@v0.35.0/eszip_wasm.generated.js:229:6)
at real (https://deno.land/x/eszip@v0.35.0/eszip_wasm.generated.js:213:14)
If I use the --legacy-bundle
flag though, I get a different error:
sh
Deploying supabase function: test
Version 1.30.3 is already installed
Bundling test
Error: Error bundling function: exit status 1
error: Module not found "file:///services/users/user.service.ts".
at file:///Users/code/supabase/functions/my_function/index.ts:4:28
services
is a directory directly besides the functions
folder inside the Supabase
directory. My import_map.json file includes a path to the file. utils
is a directory outside the supabase folder. Here is my import_map.json, which is inside the functions
dir:
json
{
"imports": {
...
"/services/": "../services/",
"/utils/": "../../src/utils/",
}
}
Thanks!Jannik Wempe
04/20/2023, 6:29 PMRosibert
04/20/2023, 6:57 PMjs
import { createClient } from "@supabase/supabase-js"
import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
const supabaseClient = createClient(
// Supabase API URL - env var exported by default.
Deno.env.get('SUPABASE_URL') ?? '',
// Supabase API ANON KEY - env var exported by default.
Deno.env.get('SUPABASE_ANON_KEY') ?? '',
)
serve(async (req) => {
const { userId } = await req.json()
supabaseClient.from('user_roles').insert({user: userId, role: 'customer'})
return new Response(
JSON.stringify(data),
{ headers: { "Content-Type": "application/json" } },
)
})
Now the deployment does not work because of the relative import in line 1.
Can I import the supabase client via an absolute path anyhow? If so: where can I read up on this?pippin_mole
04/20/2023, 7:40 PMquintin
04/20/2023, 7:59 PMpid1
04/20/2023, 8:24 PMTotallyNervous
04/20/2023, 9:43 PMauth.uid() IS NOT NULL
I was expecting to receive a 401 unauthorized error but it returns 200 with an empty array, is this normal behaviour?
Any help is appreciated!DwarfNinja
04/20/2023, 10:29 PM!inner
but I have not yet been able to figure it out:
The tables:
profiles {
id PK
name
username
}
friends {
id PK
user FK profiles.id
friend FK profiles.id
}
The current implementation:
dart
getAllIdsOfFriends() async {
var friendIds = await supabase
.from('friends')
.select('friend')
.eq('user', supabase.auth.currentUser!.id);
final List<String> friendIdsList = friendIds.map<String>((obj) => obj['friend'] as String).toList();
return friendIdsList;
}
getAllFriends() async {
List<String> friendIdsList = await getAllIdsOfFriends();
var data = await supabase
.from('profiles')
.select('*')
.in_('user', friendIdsList);
return data;
}
brassotron
04/20/2023, 11:10 PMsophianana
04/20/2023, 11:33 PMdrewbie
04/20/2023, 11:40 PMSaylessss
04/21/2023, 12:33 AMsaule
04/21/2023, 1:39 AMpckimlong
04/21/2023, 2:51 AMvinciarts
04/21/2023, 5:21 AMVadorequest
04/21/2023, 7:16 AMAshwin
04/21/2023, 8:03 AMBMaD_Chillyo | ARTSY | Polygoonz
04/21/2023, 9:51 AMMirik
04/21/2023, 9:54 AM.on(
"postgres_changes",
{
event: "*",
schema: "public",
table: "users",
// i need something like this
filter:
`lat.gte=${minLat},lng.lte=${minLng},...`
},
(payload) => {
// but for now my filters are here...
}
)
DignifiedSwine
04/21/2023, 10:17 AMmagenta
04/21/2023, 10:19 AMVadorequest
04/21/2023, 10:27 AMabhi99
04/21/2023, 11:33 AMmetafoo
04/21/2023, 12:21 PM