RafaLd
01/06/2023, 6:19 PMRaf
01/06/2023, 7:17 PMALTER TABLE users OWNER TO postgres;
but i cannot work out how to fix this to create views.
This is the error output from the terminal
Error: ERROR: permission denied for schema public (SQLSTATE 42501)
At statement 0: create view "public"."users_without_checklist_today" as SELECT user_profiles.user_id,
user_profiles.user_simple_id,
user_profiles.fname,
user_profiles.lname
FROM user_profiles
WHERE ((user_profiles.isadmin = false) AND (NOT (EXISTS ( SELECT 1
FROM checklist
WHERE ((user_profiles.user_id = checklist.user_id) AND (checklist.created_at = CURRENT_DATE))))))
Lewey
01/06/2023, 8:07 PMconst createCheckoutSession = async (req, res) => {
const supabase = createServerSupabaseClient({ req, res })
// Check if we have a session
const { data: { session } } = await supabase.auth.getSession()
if (!session) {
res.status(401).redirect('/signin')
}
}
Error
error - TypeError: resolver is not a function
at Object.apiResolver (/Users/redacted/Code/personal/redacted/node_modules/next/dist/server/api-utils/node.js:367:15)
drewbie
01/06/2023, 10:05 PMfunction runFunctionThatThrowsError() {
throw new Error("Hey!")
}
export async function handler(req: Request) {
try {
const requestData: CreateCheckoutRequestData = await req.json();
runFunctionThatThrowsError();
return new Response(
JSON.stringify({}),
{
headers: { ...corsHeaders, "Content-Type": "application/json" },
status: 200,
}
);
} catch (e) {
console.log("got error in catch", e);
return new Response(JSON.stringify(e), {
headers: { ...corsHeaders, "Content-Type": "application/json" },
status: 500,
});
}
}
When that function runs, it'll print "Hey" to the console.
When I try to invoke the function in the client with
const { error: checkoutQueryError } =
await client.functions.invoke<CreateCheckoutResponse>("validate-checkout");
error prints
[FunctionsHttpError: Edge Function returned a non-2xx status code]
How do I get "Hey", or the error message thrown in the function into the client? Any help is appreciated.cannap
01/06/2023, 10:17 PMSheprekt
01/06/2023, 10:37 PMNin
01/07/2023, 12:11 AMDDupasquier
01/07/2023, 3:53 AMsolibe1
01/07/2023, 4:22 AMtomoliveri
01/07/2023, 4:40 AMalexanderwford
01/07/2023, 8:25 AMstop-color
. Did you mean stopColor
?
* Warning: Invalid DOM property stop-opacity
. Did you mean stopOpacity
?
'use client';
// Imports
// ========================================================
import { useEffect} from "react";
import { createClient } from "@supabase/supabase-js"; // for supabase's function
import { ThemeSupa, Auth } from "@supabase/auth-ui-react"; // for Auth UI
import { useRouter } from "next/navigation";
// Page
// ========================================================
const supabase = createClient(
HIDDEN
);
const AuthUI = () => {
const router = useRouter();
useEffect(() => {
const checkSession = async () => {
const { data } = await supabase.auth.getSession();
if (data.session) {
router.push("/");
}
};
checkSession();
});
supabase.auth.onAuthStateChange((event) => {
if (event == "SIGNED_IN") {
router.push("/dashboard");
}
});
return (
<Auth
supabaseClient={supabase}
appearance={{ theme: ThemeSupa }}
providers={['azure']}
theme="dark"
view="sign_in"
/>
)
};
export default AuthUI;Marius.Dmn
01/07/2023, 7:24 AMJack Kazanjyan
01/07/2023, 9:11 AMJude
01/07/2023, 9:40 AMNin
01/07/2023, 9:51 AMDembe
01/07/2023, 12:18 PMWobbley
01/07/2023, 1:29 PMEhh
01/07/2023, 3:58 PMjs
async function signInWithGithub() {
await supabaseClient.auth.signInWithOAuth({
provider: "github",
options: {
redirectTo: "http://localhost:3000/dashboard",
},
});
}
However when I get redirected to the dashboard page, the middleware does not fetch the session as it returns null
. If I reload the page the session gets fetched correctly on the middleware.
What could be the issue? 🤔a guy
01/07/2023, 4:02 PMsupabase.auth.signUp({email: "email", password: "password"}, {redirectTo: "http://localhost:8910/account"})
I've done the below with RedwoodJS, but I don't get redirected. The user gets created. I've also set the redirect url(s) in Auth -> settings -> config url.
const { logIn, signUp } = useAuth()
const handleSign = async (email, password, signMethod) => {
try {
setLoading(true)
# signMethod is either logIn or signUp from useAuth()
const { error } = await signMethod(
{
email,
password,
},
{
redirectTo: 'http://localhost:8910/account',
}
)
if (error) throw error
} catch (error) {
alert(error.error_description || error.message)
} finally {
setLoading(false)
}
}
talpiven
01/07/2023, 4:11 PMSandySeagull
01/07/2023, 4:21 PMDarrellSmith
01/07/2023, 5:00 PMluke90275
01/07/2023, 7:09 PMdandis
01/07/2023, 8:29 PMsilas
01/07/2023, 9:44 PMgwu
01/07/2023, 10:42 PMsupabase.auth.sign_up()
with a duplicate account, how do I catch the error?
This is essentially what my code looks like, but e is blank instead of returning 'duplicate account' or an error like that.
try:
user = supabase.auth.sign_up(email=email, password=password).json()
return user
except Exception as e:
print(e)
Thank you very much in advance!silas
01/07/2023, 11:15 PMjs
import { createClient } from '@supabase/supabase-js';
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
export const GET = async () => {
console.log(await supabase.auth.admin.listUsers());
};
This fails with an AuthRetryableFetchError, as well as any other auth actions I try to take. Anything with .from() all seems to work, returning and updating data just fine. I am using the service_role key. This is all on localhost.cats
01/07/2023, 11:51 PMnahtnam
01/08/2023, 1:26 AMconst { data: quotes } = await supabaseClient
.from('view_random_quotes' as unknown as 'quotes')
.select('*,quote_categories(name)')
.lte('LENGTH(quote)', 50)
.eq('quote_categories.name', categoryName)
.limit(5)
.throwOnError();
My two questions are:
1. How can I make the LENGTH
filter work? Right now it says column view_random_quotes.LENGTH does not exist
2. The resulting data (after removing the length issue) does not provide me the quote_categories.name
value. How can I have supabase include that result?