tsnakejake
05/25/2023, 4:34 PMhttps://cdn.discordapp.com/attachments/1111331534327263262/1111331534528581745/image.png▾
prashant
05/25/2023, 4:41 PMmicrobinson
05/25/2023, 4:45 PMvikay
05/25/2023, 5:03 PMJaba
05/25/2023, 5:03 PMformigueiro
05/25/2023, 5:23 PMsql
DECLARE
slash_position INT;
value int;
entry_id int;
BEGIN
-- Encontra a posição da última ocorrência do caractere '/'
slash_position := strpos(reverse(new.short_url), '/');
-- Extrai o valor após a última ocorrência do caractere '/'
value := reverse(substring(reverse(new.short_url) from 1 for slash_position - 1));
select id
from url_data
into entry_id
where slug = value;
update public.report_data
set id = entry_id
where id = new.id;
RETURN new;
END;
erro : "No operator matches the given name and argument types. You might need to add explicit type casts."
MarkeD
05/25/2023, 6:19 PMharshcut
05/25/2023, 6:26 PMjustifi
05/25/2023, 6:28 PMpg-meta
service
They all work fine except for /tables
, e.g https://api.supabase.io/platform/pg-meta/my_project_id/tables
I consistently get the same error.
Using the logs, I identified the query that's called from pg-meta/tables
( see below )
When I run it in my SQL editor, its taking >30 seconds - is the 500 Error caused by a timeout on the query?
I played around with the last line of the query, excluding various schemas to identify the bottleneck.
I am using supabase as my database for a Strapi instance (headless CMS with lots of relations), and that schema is taking nearly 15 seconds on its own.
What are my options here? I'd like to be able to use the supabase dashboard - I use Supabase Webhooks to notify external systems of changes to my CMS.
https://cdn.discordapp.com/attachments/1111360080433139783/1111360080697372722/image.png▾
bmahr
05/25/2023, 7:23 PMterrxo
05/25/2023, 7:43 PMSebsa
05/25/2023, 8:01 PMzerefati
05/25/2023, 8:38 PMf41z37
05/25/2023, 8:44 PMfloitsch
05/25/2023, 8:54 PMsupabase start
the schemas are not correctly loaded.
I used to get FAILED: 500 - Database error querying schema
when accessing the database the first time after a restart. That wasn't a huge problem, as the next call would then usually work. (I'm guessing the error triggered a reload).
However, since I added an edge function to my setup, I can't access the functions through the usual RPC calls anymore. (Interestingly, the edge function has full access to all functions).
Only when I reload the cache (either using docker kill -s SIGUSR1 <container>
or using NOTIFY pgrst, 'reload schema'
from studio) can I access the functions again.
I tried to add NOTIFY pgrst...
to my seed script, but that didn't help. Does anyone have a tip on how I could easily reload the schema? I'm running the self-hosted supabase as part of testing, and I would need to do this in an automated way.
Setup:
- Supabase version 1.50.12
- Archlinux (fully up to date)
- the supabase instance has non-standard ports.francis
05/25/2023, 9:02 PMsupabase db remote commit
immediately generates a migration which cannot be applied (EDIT: to an instance started via the supabase cli) and fails. The offending line is:
CREATE EXTENSION IF NOT EXISTS "supabase_vault" WITH SCHEMA "vault";
This fails in the type generation CI with: Error: ERROR: extension "supabase_vault" is not available (SQLSTATE 0A000)
.Hugo Peran
05/25/2023, 9:09 PMError inserting data: ${error.message}
);
} else if (data && data.length > 0) {
data.forEach((record) => {
console.log(Inserted company data: ${JSON.stringify(record)}
);
});
} else {
console.log('No data inserted');
}
})
.on('end', () => {
console.log('CSV file successfully processed');
});
Terminal response in the first commentbennettcolecohen
05/25/2023, 10:10 PMthαwαn
05/25/2023, 10:17 PMDeno.createHttpClient
function. It works locally, but when I deployed to supabase at runtimes it throws an error Deno.createHttpClient is not a function
.
My guess is that it may be that supabase edge functions by default do not come with the unstable
flag as true
. Is there a way to make this work?D3R1K
05/25/2023, 10:35 PMcreateServerComponentSupabaseClient
export async function middleware(req: NextRequest) {
const res = NextResponse.next();
const supabase = createMiddlewareSupabaseClient({ req, res });
const {
data: { session }
} = await supabase.auth.getSession();
if (!session && req.nextUrl.pathname.startsWith('/required-session')) {
// Auth condition not met, redirect to home page.
const redirectUrl = req.nextUrl.clone();
redirectUrl.pathname = '/dashboard';
redirectUrl.searchParams.set(redirectedFrom
, req.nextUrl.pathname);
return NextResponse.redirect(redirectUrl);
}
return res;
}`
https://github.com/supabase/auth-helpers/blob/main/examples/nextjs-server-components/middleware.tsx
https://cdn.discordapp.com/attachments/1111422411062124594/1111422411338944592/image.png▾
ostoto
05/25/2023, 10:41 PMGrantly
05/25/2023, 11:11 PM.Volxen
05/25/2023, 11:32 PMhttps://cdn.discordapp.com/attachments/1111436686153486439/1111436686610661376/image.png▾
https://cdn.discordapp.com/attachments/1111436686153486439/1111436686946209902/image.png▾
xdcx18
05/26/2023, 1:01 AMsql
CREATE OR REPLACE FUNCTION update_quantity(storeId bigint)
RETURNS void
LANGUAGE plpgsql
AS $$
BEGIN
BEGIN;
SELECT SUM(quantity) AS total_quantity
INTO total_quantity
FROM public.grocerystoreitems
WHERE "storeId" = storeId AND quantity > 0;
UPDATE grocerystores
SET quantity = total_quantity
WHERE Id = storeId;
COMMIT;
END;
$$;
https://cdn.discordapp.com/attachments/1111459092783968317/1111459093224378388/Screenshot_2023-05-25_at_7.58.09_PM.png▾
scook
05/26/2023, 1:07 AMconst uppy = new Uppy()
.use(Webcam, {
modes: ['video-audio', 'audio-only']
})
.use(Audio, {
showAudioSourceDropdown: true
})
.use(Tus, {
endpoint: `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/upload/resumable`,
headers: {
authorization: `Bearer ${process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY}`
},
chunkSize: 6 * 1024 * 1024,
allowedMetaFields: [
'bucketName',
'objectName',
'contentType',
'cacheControl'
]
});
On staging, NEXT_PUBLIC_SUPABASE_URL
is https://<my-project-id>.supabase.co
, whereas on local it is http://localhost:54321
. Locally, the upload results in net::ERR_CONNECTION_REFUSED
.
Is it possible to get the local instance to support the same? Am I able to do whatever it is support did for the staging instance but for my local?
Thanks.
https://cdn.discordapp.com/attachments/1111460646131875892/1111460646744240228/Screenshot_2023-05-25_at_5.56.21_PM.png▾
kal
05/26/2023, 1:10 AMformigueiro
05/26/2023, 1:28 AMsql
DECLARE
entry_count int;
total_urls integer;
current_type url_type;
BEGIN
-- Obtém o subscription_tier do usuário associado à nova URL
select COUNT(*) - 1
into entry_count
from url_data e
where e.user_id = new.user_id AND e.type = 'free';
-- Verifica se o total de URLs é menor ou igual a 10
IF total_urls <= 10 THEN
current_type = 'free'::url_type;
ELSE
current_type = 'payed'::url_type;
END IF;
-- raise exception 'total_urls %', total_urls;
update public.url_data
set type = current_type
where id = new.id;
RETURN NEW;
END;
i checked total_urls value so even that i have less 10 im getting payed on the tableda newb
05/26/2023, 2:26 AMemail_confirmed == true
, while still allowing them to sign in with their account even before email confirmation?
(B) What columns in the database are set when a user confirms their email address? If I were to check just one DB column, which one should I check?
(C) Can I consider the database table for auth.users
(or a view of that table) stable in terms of an API? AKA can I rely on it for important auth decisions, or must I rely on Supabase SDKs?
(C) If a user changes the email address for the auth.user
entry, does the new email become "unconfirmed"?
(D) Do OAuth signups automatically set the underlying email address as confirmed?
(E) Can I have a successful password reset move an email address from unconfirmed to confirmed? This would be necessary for goal (1) that I'm trying to achieve above.
Thanks.AD DAB
05/26/2023, 6:33 AMhttps://cdn.discordapp.com/attachments/1111542491452297226/1111542491586510888/image.png▾
Indic Software
05/26/2023, 6:48 AM