Wamy
03/11/2023, 9:48 PMjs
const { data, error } = await.userSupabase.auth.signIn({
email: email,
password: password,
})
console.log(error)
console.log(data)
This code returns nothing when run using the normal createClient using my service_key or my anon key. When I try and use the functions code, req
is not defined because you have to use it in the deno server which I cannot in this case. Is there anyway to verify a user's credentials on the server? Its using basic auth to login so I have no jwt or anything like that.samuel83
03/11/2023, 10:16 PMyarbo
03/11/2023, 10:16 PMjarnold
03/11/2023, 10:30 PM- run: supabase functions deploy your-function-name --project-ref $PROJECT_ID
A-PRYME
03/12/2023, 12:43 AMusers
is the name of the table, and address
is a jsonb
column.SomGG
03/12/2023, 1:18 AMrattlesnake
03/12/2023, 1:20 AMStewball32
03/12/2023, 2:43 AMnpx supabase db diff
keeps resulting in this error. I'm completely in the dark as to what's going on and why it's not working.jonah
03/12/2023, 6:42 AMDEBUG Specifier "https://esm.sh/v111/openai@3.1.0/esnext/openai.js" was not mapped in import map.
DEBUG Specifier "https://esm.sh/v111/form-data@4.0.0/esnext/form-data.js" was not mapped in import map.
DEBUG Specifier "https://esm.sh/v111/axios@0.26.1/esnext/axios.js" was not mapped in import map.
DEBUG Specifier "https://esm.sh/v111/node_process.js" was not mapped in import map.
DEBUG Specifier "https://esm.sh/v111/node_events.js" was not mapped in import map.
worker thread panicked ReferenceError: window is not defined
at https://esm.sh/v111/form-data@4.0.0/esnext/form-data.js:24:59
at https://esm.sh/v111/form-data@4.0.0/esnext/form-data.js:6:27
at https://esm.sh/v111/form-data@4.0.0/esnext/form-data.js:32:11
I don't know how to define the window for that form-data module. Can anyone help? I tried defining the window in my serve function but that didn't work.mct.dev
03/12/2023, 7:14 AMDean1
03/12/2023, 8:31 AMSTILLWATER;
03/12/2023, 11:59 AMsql
CREATE OR REPLACE FUNCTION upload_contacts(contacts json[]) RETURNS VOID AS $$
BEGIN
INSERT INTO "Contact" (user_id, phonenumber)
SELECT (d->>'user_id')::uuid, d->>'phonenumber'::character varying
FROM (SELECT json_array_elements($1::json) as d) tmp
ON CONFLICT (user_id, phonenumber) DO NOTHING;
RETURN;
END;
$$ LANGUAGE plpgsql;
Razoth
03/12/2023, 12:09 PMjs
export async function getStaticProps(context: {
params: { id: number };
}): Promise<{
props: {
quote: {
created_at: string;
id: number;
network: string | null;
old_id: number;
rows: import("../../types/supabase").Json;
score: number | null;
timestamp: string | null;
};
};
}> {
const id = context.params.id;
const { data, error } = await supabase
.from("quotes")
.select("*")
.eq("id", id)
.maybeSingle();
if (error) {
console.log(error);
}
return {
// Passed to the page component as props
props: { quote: data! },
};
}
inside the component i did this:
js
type prop = {
quote: data;
};
type data = {
id: string;
created_at: Date;
score: number;
network: string;
timestamp: Date;
rows: [];
};
type rows = {
row: number;
content: string;
};
export default function QuoteCard({ quote }: prop).....
is this correct?ShareOne
03/12/2023, 12:38 PMAaron8646
03/12/2023, 3:52 PMDean1
03/12/2023, 3:53 PMVishwanth22
03/12/2023, 4:38 PMSniped137
03/12/2023, 4:44 PMfloyare
03/12/2023, 4:55 PMjdgamble555
03/12/2023, 7:31 PMdavidf
03/12/2023, 7:33 PM[
{
id: 'uuid',
authorid: '1', // as uuid
},
{
id: 'uuid',
authorid: '2', // as uuid
}
]
And I'm trying to filter down by a given list of users:
const userIds = [uuid, uuid, uuid] // etc
This is how I've tried filtering (following the docs):
query.filter("authorid", "cs", `{${mappedIds.join(",")}}`);
I also tried:
query.containedBy("authorid", mappedIds.join(","));
But I'm getting the following error:
{
"code": "42883",
"details": null,
"hint": "No operator matches the given name and argument types. You might need to add explicit type casts.",
"message": "operator does not exist: text @> unknown"
}
I'm not sure how I'd typecast this? 🤔 anyone got a clue?christer
03/12/2023, 8:38 PMclient.auth.signInWithPassword
function, and it gets a session on the first submission, but it does not redirect using the navigateTo
built in Nuxt function.
I've tried the following:
1. Using the router instead of navigateTo
2. Tried creating another function with the actual supabase function inside it, calling it with await
within the signIn
function. This seems to fix the submit on pressing enter issue, but not when clicking the button.
3. Setting a timeout of 2 seconds before doing the navigateTo
part
4. Creating a `if(data.xx)`before the navigateTo
, to ensure we have the session before.
None of the above solves the issue.
SignIn form:
<form @submit.prevent="signIn">
<label for='email'> E-mail</label>
<input
type="email"
placeholder="Email"
v-model="email"
id='email'
/>
<div class="element input password">
<label class="atom" for='password'> Password </label>
<input class="atom"
type="password"
placeholder="Password"
v-model="password"
id='password'
/>
</div>
<button @click="signIn()">
sign in
</button>
</form>
SignIn function:
const signIn = async () => {
const {data, error} = await client.auth.signInWithPassword({
email: email.value,
password: password.value,
})
return navigateTo('/portfolio')
}
gilroy
03/12/2023, 8:51 PMcallumboase
03/12/2023, 9:44 PMimagio
03/12/2023, 10:12 PMpostgres
module. I found postgres.js
(https://github.com/porsager/postgres) which seems like a really nice API and I'm considering using it in code that might run both on the client and on edge functions.
I don't see any reason not to use postgres-js
instead of postgrest
but I want to ask those with more experience if I'm missing some important functionality that only postgrest
offers.
Is anybody using an alternative postgres client such as postgres.js rather than the default postgrest-js client that is part of supabase-js? If so, are there any particular pitfalls that might result from doing so?Eryou Hao
03/13/2023, 1:33 AMnote_site_ref
table's publishAt
column.
javascript
const result = await supabaseClient
.from('note')
.select(`
*,
site!inner (
id
),
extra:note_site_ref!inner (
publishAt
)
`, { count: 'exact' })
.match({ 'site.id': siteId })
.order('note_site_ref(publishAt)', { ascending: false })
.range(from, to)
but get the error:
javascript
{
error: {
code: 'PGRST100',
details: `unexpected '(' expecting letter, digit, "-", "->>", "->", delimiter (.), "," or end of input`,
hint: null,
message: '"failed to parse order (note_site_ref(publishAt).desc)" (line 1, column 14)'
},
data: null,
count: null,
status: 400,
statusText: 'Bad Request'
}
meow
03/13/2023, 3:24 AMEK
03/13/2023, 3:34 AMjarvis
03/13/2023, 3:42 AMPeanut
03/13/2023, 3:48 AM