jfbn
02/19/2023, 1:55 PMAntDX316
02/19/2023, 3:13 PMtheravenstone
02/19/2023, 3:23 PMOrangeπ
02/19/2023, 3:29 PM_AuthRetryableFetchError: fetch failed [...] _isAuthError: true, status: 0
I am using SvelteKit with AuthHelpers and here's a quick overview of my code in `.../sign-in/+page.server.ts`:
export const actions: Actions = {
default: async (event) => {
const { request } = event;
const { supabaseClient } = await getSupabase(event);
const { error } = await supabaseClient.auth.signInWithPassword({
email: email,
password: password
});
if (error) console.error(error)
Prashant Singh
02/19/2023, 3:34 PMtheravenstone
02/19/2023, 5:01 PMRuzelmania
02/19/2023, 5:36 PMtheravenstone
02/19/2023, 5:36 PM[
{
"id": 10,
"partnername": "sd",
"total": [
{
"count": 3
}
]
},
{
"id": 12,
"partnername": "Gk",
"total": [
{
"count": 2
}
]
}
]
would like to get
[
{
"id": 10,
"partnername": "sd",
"count": 3
},
{
"id": 12,
"partnername": "Gk",
"count": 2
}
]
current code:
ts
const { data } = await client.from('partners').select('id,partnername, total:activity_has_partner(count)').eq('created_by', user.value.id).order('created_at')
misakss
02/19/2023, 5:43 PMqueb
02/19/2023, 5:43 PMpheralb
02/19/2023, 5:55 PMtsx
import { createMiddlewareSupabaseClient } from "@supabase/auth-helpers-nextjs";
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
export async function middleware(req: NextRequest) {
const res = NextResponse.next();
const supabase = createMiddlewareSupabaseClient({ req, res });
const {
data: { session },
} = await supabase.auth.getSession();
// Set Auth URL:
const isAuthPage = req.nextUrl.pathname.startsWith("/auth");
// If authenticated, redirect to dashboard:
if (isAuthPage) {
if (session?.user.id) {
return NextResponse.redirect(new URL("/dash", req.url));
}
return null;
}
// If not authenticated, redirect to auth page:
if (!session?.user.id) {
let from = req.nextUrl.pathname;
if (req.nextUrl.search) {
from += req.nextUrl.search;
}
return NextResponse.redirect(
new URL(`/auth?from=${encodeURIComponent(from)}`, req.url),
);
}
}
export const config = {
matcher: ["/dash/:path*", "/auth"],
};
If in path /dash/url, which is protected by middleware, I use getServerSideProps to get the data from a table it returns Error 500:
tsx
export const getServerSideProps = async (
ctx: GetServerSidePropsContext<ParsedUrlQuery, PreviewData>,
) => {
const { url } = ctx.query;
// Cache data
ctx.res.setHeader(
"Cache-Control",
"public, s-maxage=10, stale-while-revalidate=59",
);
// Create authenticated Supabase Client
const supabase = createServerSupabaseClient(ctx);
// Fetch single row from table
const { data } = await supabase
.from("mytable")
.select("*")
.eq("url", url)
.single();
// Redirect to 404 if no data
if (!data) {
return {
redirect: {
destination: "/404",
permanent: false,
},
};
}
return {
props: {
url,
data,
},
};
};
Aless.c06
02/19/2023, 6:21 PMkompiledstore
02/19/2023, 9:04 PMOnce a user has logged in via their first factor (email+password, magic link, one time password, social login...) you need to perform a check if any additional factors need to be verified. This can be done by using the supabase.auth.mfa.getAuthenticatorAssuranceLevel() API. When the user signs in and is redirected back to your app, you should call this method to extract the user's current and next authenticator assurance level (AAL).
Current behaviour:
After signin Im getting this data:
{
currentLevel: 'aal1',
nextLevel: 'aal1',
currentAuthenticationMethods: [ { method: 'password', timestamp: 1676839714 } ]
}
Even thought I was receiving:
{
currentLevel: 'aal2',
nextLevel: 'aal2',
currentAuthenticationMethods: [ { method: 'password', timestamp: 1676839714 ...} ]
}
before sign out.
Am I missing something? In db I can see the factor savedTripleSmile
02/19/2023, 9:07 PMdart
final supabase = Supabase.instance.client;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Supabase.initialize(
url: 'https://lalala.supabase.co',
anonKey:
'myanonkey',
);
runApp(const MyApp());
}
My main runApp class looks like this:
dart
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: GridView.count(
crossAxisCount: 4,
children: ButtonList().create(),
),
),
);
}
}
I basically create a list of buttons where each one plays a sound
Here's how my buttons list look:
dart
class ButtonList {
static const double textSize = 50;
create() {
return [
ElevatedButton(
child: const Text("iΛ", style: TextStyle(fontSize: textSize)),
onPressed: () {
AudioPlayer().play(AssetSource("01.wav"));
},
),
ElevatedButton(
child: const Text("uΛ", style: TextStyle(fontSize: textSize)),
onPressed: () {
AudioPlayer().play(AssetSource("02.wav"));
},
),
ElevatedButton(
child: const Text("Κ", style: TextStyle(fontSize: textSize)),
onPressed: () {
AudioPlayer().play(AssetSource("03.wav"));
},
),
ElevatedButton(
child: const Text("Ιͺ", style: TextStyle(fontSize: textSize)),
onPressed: () {
AudioPlayer().play(AssetSource("04.wav"));
},
),
];
}
}
I want to make it so that the 1st button of a list has an extra text which is retrieved from supabase 'notes' table text_column column. Where do I start? Sorry if the question looks trivial, but I have no experience with databases...Julien
02/19/2023, 9:24 PMcaseycrogers
02/19/2023, 9:27 PMmauricev
02/20/2023, 4:38 AM{
"log": "** (Postgrex.Error) ERROR 3F000 (invalid_schema_name) no schema has been selected to create in\n",
"stream": "stderr",
"time": "2023-02-20T04:26:44.02981013Z"
}
2, supabase/gotrue
problem creating schema migrations: couldn't start a new transaction: could not create new transaction: failed to connect to `host=db user=supabase_auth_
admin database=postgres`: failed SASL auth (FATAL: password authentication failed for user \\\"supabase_auth_admin\\\" (SQLSTATE 28P01))\",\"time\":\"2023-02-20T04:27:09Z\"}\n","stream":"stderr","time":"2023-02-20T04:27:09.68
520345Z"}
3, kong
/var/lib/kong/kong.yml: No such file or directory\n","stream":"stderr","time":"2023-02-20T04:28:28.638856047Z"}
4, supabase/storage-api
error: password authentication failed for user \"supabase_storage_admin\"\n","stream":"stderr","time":"2023-02-20T04:19:29.727949168Z"}
Dong
02/20/2023, 5:51 AMakrolsmir
02/20/2023, 7:08 AM{
"message": "No API key found in request",
"hint": "No `apikey` request header or url param was found."
}
The only other reference I can find online is https://stackoverflow.com/questions/74512907/supabase-signinwithpassword-is-giving-me-a-502-error, which seems to be the same error message but has no solution.kresimirgalic
02/20/2023, 7:21 AMnahtnam
02/20/2023, 7:42 AMauth.users
table?redlumxn
02/20/2023, 7:48 AMsupabase_migrations.schema_migrations
table per DB instance, not sure if this is possible.Aless.c06
02/20/2023, 8:20 AMconst { data, error } = await supabase.rpc('join_lobby', {
username_input: 'Username',
pfp_input: 'avatar.png',
tag_input: '#1234',
lobbyID: 1
});
Hutchie
02/20/2023, 9:08 AMits_Susmita
02/20/2023, 9:55 AMdev Joakim Pedersen
02/20/2023, 9:59 AMA-PRYME
02/20/2023, 11:05 AMRestaurant
and Address
. A restaurant has an address. How my I get a list of restaurants ordered from nearest to farthest given that an address has a location
column of type GeoPoint?dev Joakim Pedersen
02/20/2023, 11:11 AMBarry | Fansea
02/20/2023, 11:12 AMSoul
02/20/2023, 11:33 AMselect * from hotels
inner join rooms
on hotels.id = rooms.hotel_id
left join reservations
on rooms.id = reservations.room_id
where reservations IS NULL OR reservations.start_date > 'value' OR reservations.end_date < 'value'
into supabase-js code?