VuNguyen
01/26/2023, 4:21 PMsql
select (COALESCE((regexp_matches(name, '^\D*(\d+(?:\.\d+)?)'))[1]::numeric, 0)), name from kaguya_chapters where slug = 'cmk-2367229' limit 1
it returns
Failed to run sql query: set-returning functions are not allowed in COALESCE
Expected result
Chapter 124.5: Omake Volume 14 -> 124.5A-PRYME
01/26/2023, 4:35 PMdogedogego
01/26/2023, 4:39 PMstreamerd
01/26/2023, 4:52 PMDomcario
01/26/2023, 5:00 PMcompany
with columns owner
(uuid) and members
(uuid array). i have the currently signed in user's uuid saved as an object called user_id
i'd like to query for all rows in company
where user.id is equal to the row's owner value OR user.id is one of the uuids in the array for members
currently trying this with a string literal, following along docs here https://supabase.com/docs/reference/javascript/or
js
const { data, error } = await supabase
.from('company')
.select()
.or(`owner.eq.${user_id},members.cs.{${user_id}}`)
Lukas V
01/26/2023, 5:09 PMsignInWithOAuth
logic into my login modal.
Everything works, however, I currently have very bad user experience due to my loading state not being set properly.
Here is my code:
const handleOAuthSignIn = async (provider: Provider) => {
toast.loading('Signing you in with ' + provider + '...');
const { error } = await supabaseClient.auth.signInWithOAuth({
provider
// options: { redirectTo: getURL() }
});
if (!error) toast.dismiss();
if (error) {
toast.error(error.message);
toast.dismiss();
}
};
Please watch the screen recording, as you can see toaster
component is being activated only for split second before it dissappears.
This especially confusing when the internet might not be as fast, i was testing this with my friend, once he pressed the sing in with apple button, ui was unresponsive for about 5-7 seconds, even I thought at that time that it's simply not working, but it was just loading slowly.
How do I overcome this issue?AntDX316
01/26/2023, 5:14 PMjaypinho
01/26/2023, 5:15 PMSELECT daily_company_counts.*, companies.company
FROM daily_company_counts
join companies on companies.id = daily_company_counts.company_id
WHERE normalized_date = '2023-01-22'
This returns 906 rows.
However, no matter how I structure my PostgREST query, I cannot get it to work. Either:
a) I do a join without using inner
, which results in me receiving those same 906 rows but 781 of them come back with no associated resource in the companies
table:
https://abhxwgvatqovevkjxlyy.supabase.co/rest/v1/daily_company_counts?apikey=[KEY]&select=*,companies!daily_company_counts_company_id_fkey(company)&normalized_date=eq.2023-01-22
OR
b) I do a join using inner
and get back only the 125 rows:
https://abhxwgvatqovevkjxlyy.supabase.co/rest/v1/daily_company_counts?apikey=[KEY]&select=*,companies!daily_company_counts_company_id_fkey!inner(company)&normalized_date=eq.2023-01-22
Am I missing something here?Eric Hanson
01/26/2023, 5:27 PMpsql
. I'm just pasting in the provided prompt in the Database Settings section if the UI and using the password I set but it is not working:
eric@play:~/dev$ psql -h db.nalqklftpdqglmwfbuoy.supabase.co -p 5432 -d postgres -U postgres
Password for user postgres:
psql: error: connection to server at "db.nalqklftpdqglmwfbuoy.supabase.co" (18.231.187.145), port 5432 failed: FATAL: password authentication failed for user "postgres"
connection to server at "db.nalqklftpdqglmwfbuoy.supabase.co" (18.231.187.145), port 5432 failed: FATAL: password authentication failed for user "postgres"
Two problems, first the login didn't work with the above message so I thought maybe I have the wrong password, so I changed it, and then the port just closed and I could no longer connect:
eric@play:~/dev/aquameta$ psql -h db.nalqklftpdqglmwfbuoy.supabase.co -p 5432 -d postgres -U postgres
psql: error: connection to server at "db.nalqklftpdqglmwfbuoy.supabase.co" (18.228.119.85), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
However I worked around this, I paused my project and then restarted, and that fixed the issue with the port being closed. But still, password wont' work. I also tried doing an ALTER ROLE postgres LOGIN
but that also didn't fix it. Any ideas? Thanks!tarkan
01/26/2023, 5:39 PMRaphael_
01/26/2023, 5:42 PMuser8923
01/26/2023, 5:59 PMpckimlong
01/26/2023, 6:07 PMDanMossa
01/26/2023, 7:18 PM0
. I'm wondering if other people are having the same issue?Vik
01/26/2023, 7:23 PMCREATE POLICY followers_insert_policy ON followers
FOR INSERT
WITH CHECK (NOT EXISTS (SELECT 1 FROM profiles WHERE profiles.id = NEW.user_id AND profiles.private = TRUE)
AND current_user = 'authenticated_role');
This is the error I get:
Failed to run sql query: missing FROM-clause entry for table "new"
ryanT
01/26/2023, 7:34 PMexport default function supabaseLoader({ src, width, height, quality }) {
return `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/render/image/public/${src}?width=${width}&height=${
height
}&quality=${quality || 75}`
}
Heres my next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
eslint: {
ignoreDuringBuilds: true,
},
images: {
loader: 'custom',
loaderFile: './scripts/supabase-image-loader.js',
remotePatterns: [
{
protocol: 'http',
hostname: 'localhost',
port: '54321',
pathname: '/storage/v1/**',
},
{
protocol: 'https',
hostname: process.env.NEXT_PUBLIC_SUPABASE_URL,
port: '',
pathname: '/storage/v1/**',
},
],
}
}
module.exports = nextConfig
GET http://localhost:54321/storage/v1/render/image/public/bucket-name/customer_banner.png?width=1920&height=undefined&quality=75 400 (Bad Request)
I also notice that the width and height in the get request are not what I've entered:
<Image
src={'bucket-name/customer_banner.png'}
priority={true}
alt="banner-image"
width={1600}
height={1600}
/>
I've tried this on my local development supabase instance as well as my hosted one on supabase.com. Both result in 400s.
I've also tried without the supabase-image-loader.js via:
const bannerUrl = supabase.storage.from('bucket-name').getPublicUrl('customer_banner.png', {
transform: {
width: 1600,
height: 1600,
},
});
Same thing happens.
Any ideas here?Vik
01/26/2023, 8:25 PMryanT
01/26/2023, 9:07 PMexport default function supabaseLoader({ src, width, height, quality }) {
return `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/render/image/public/${src}?width=${width}&height=${height}&quality=${quality || 75}`
}
<Image
src={'customer-assets/folder-name/customer_banner.png'}
priority={true}
alt="banner-image"
width={1600}
height={1600}
/>
http://localhost:54321/storage/v1/render/image/public/customer-assets/folder-name/customer_banner.png?width=1920&height=undefined&quality=75
cohlar
01/26/2023, 9:19 PMjsonb
columns are typed as Json
even when constrained by a json schema.jj_sessa
01/26/2023, 9:54 PMfast
01/26/2023, 10:38 PMawait supabase.auth.signInWithOAuth({
provider: 'google',
options: {
redirectTo: REDIRECT_URL
}
})
After a successful login the user gets redirected to the correct location but trying to get the session returns null
React.useEffect(() => {
(async () => {
// Returns null
const session = await supabase.auth.getSession();
if(session.error && !session.data.session) {
throw new Error("No session");
}
// Make API calls
})()
});
Lmk if you need more informationandrewluo
01/26/2023, 10:55 PMBasanites
01/26/2023, 11:17 PMasync function getUser() {
const user = await supabase.auth.getUser()
if(user != null) return user;
return null;
}
but I still can't check whether or not the user is logged in. Regardless of whether or not the user is logged in, I still see "Log Out" rendered in the navbar.
export default function Navbar() {
let user = getUser()
if(user != null) { //This would return a version of my site's navigation bar with a "Log Out" button.
return(
...
)
}
}
^ That was a snippet from my navigation bar code. I'm trying to only render an tag to log out if the user is signed in.Domcario
01/26/2023, 11:54 PMelliott
01/27/2023, 1:18 AMelliott
01/27/2023, 1:51 AMroyboy789
01/27/2023, 2:43 AMclient.from().select()
but when it comes to updating client.from().update().select()
it does not want to work.
I have done everything i could to test, including copying the code directly into my app, where it works.
Is this a client side / server side issue?
Anyone have any experience with workarounds?
I saw the Egghead course using KV store, not there yet, but didn't seemed like most of that was fetching/GET data, but not updating.Ken
01/27/2023, 3:46 AMVik
01/27/2023, 4:06 AMYokoWasis
01/27/2023, 6:06 AM(auth.email() IN ( SELECT ca_admin.email
FROM ca_admin))
ca_admin table :
id | email
---|---------------------
1 | yokowasis@gmail.com
I auth using yokowasis@gmail.com, but when I try select the table, the results come empty.