gweb
01/27/2023, 8:44 AMts
import type { PostgrestResponse } from '@supabase/supabase-js';
import { getSupabase } from '@supabase/auth-helpers-sveltekit';
import type { Database } from '$lib/types/database.types';
import type { PageLoad } from './$types';
import { redirect } from '@sveltejs/kit';
type Message = Database['public']['Tables']['messages']['Row'];
export const load = (async (event) => {
const { session, supabaseClient } = await getSupabase(event);
if (!session) {
throw redirect(303, '/auth/login');
}
const { data: messages }: PostgrestResponse<Message> = await supabaseClient
.from('messages')
.select(
`
message,
created_at,
profiles (
id,
username
)
`
)
.eq('id', event.params.id);
if (!messages) {
return { messages: [] };
}
return { messages };
}) satisfies PageLoad;
Type 'PostgrestResponse<{ message: any; } & { created_at: any; } & { profiles: ({ id: any; } & { username: any; }) | ({ id: any; } & { username: any; })[] | null; }>' is not assignable to type 'PostgrestResponse<{ created_at: string; id: string; message: string; userId: string | null; }>'.
Evostance
01/27/2023, 9:13 AM! Do you even Vim, bro?
01/27/2023, 11:16 AMsrc
, maybe?Exa
01/27/2023, 11:25 AMJason Creviston
01/27/2023, 12:58 PMsignInWithOAuth
redirectTo
option - I'm just passing in the provider with the test repo. I'm using Sveltekit's goto()
in the onAuthStateChange
function, after events fire, to do my redirect.
I've created a repo you can use to test this yourself. https://github.com/j4w8n/sanity (because I'm about to lose mine)
Clone, install, npm run dev or whatever. Open a browser and dev tools console at http://localhost:5173
If you click the Email Login
button, it signs you in and properly redirects you to /app. Click Logout
button and you go back to the homepage. All is well. Now try the Github Login
button (I can delete your user later, no problemo). You may notice the browser console log 'Navigating to /app', but it never happens - at least not on my machine. It's being interrupted somewhere. Different browsers do different things. Firefox will show vite reconnecting. Chrome shows it's navigating to the homepage. In both instances, you can usually see that it's trying to go to the "redirectTo" url twice - the supabase project's base url in this case, since we aren't setting it in the signIn function. However, I've passed-in this option while testing in other projects, and that's what shows up twice.
Does it work for you?
I cannot figure this out. I've even tried a 1.0.0-next.xxx versions of sveltekit which allowed me to downgrade to vite 3.2.0, and supabase-js 2.0.0. Still have issues. Which is strange, because I don't recall having issues with this in the past with supabase-js v2. I've even tried it on my mac, because I've been using a new Windows laptop and thought that had something to do with it.AntDX316
01/27/2023, 1:59 PMkabaday
01/27/2023, 2:15 PMMateusz27
01/27/2023, 2:37 PMjson
{
"message": "No API key found in request",
"hint": "No apikey request header or url param was found."}
I made all steps from the official supabase documentation: https://supabase.com/docs/guides/getting-started/tutorials/with-flutter
I also put my poc project to git: https://github.com/Mateusz-92/Test-App-Supabase.
Here is a part of my anroid manifest file:
xml
<!-- Add this intent-filter for Deep Links -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="io.supabase.test_app_supabase"
android:host="reset-password" />
</intent-filter>
and my url configuration from supabase: io.supabase.test_app_supabase://reset-password/
Did anyone have similar problem or has some hints ?lake_mattiato
01/27/2023, 2:52 PMlake_mattiato
01/27/2023, 3:20 PMFlorent
01/27/2023, 4:06 PMR3FluX
01/27/2023, 4:25 PMpickwickian
01/27/2023, 4:36 PMsoleun (Uiflow)
01/27/2023, 6:15 PMEnyel
01/27/2023, 6:26 PMItsLeffdePeff
01/27/2023, 6:34 PMOlyno
01/27/2023, 6:42 PMDomcario
01/27/2023, 8:24 PMid
col is the primary key and identity, so it is "Automatically assigned a sequential unique number to the column"
but i get a error duplicate key value violates unique constraint "events_id_key"
details: "Key (id)=(1) already exists."
so it's starting to insert rows with id 1 instead of 157. how would i fix this?shananananan
01/27/2023, 10:23 PMTarky
01/27/2023, 10:28 PMSmardrengr
01/28/2023, 12:19 AMBannedFromLeague
01/28/2023, 12:35 AMSmardrengr
01/28/2023, 12:40 AM{
"type": "invalid",
"status": 500,
"data": {
"error": "Server error. Try again later.",
"values": {
"email": "me@gmail.com"
}
}
}
And I've updated the local .env
to point to my new custom domain...
In production, which is using the old Supabase hostname, auth works fine. What am I missing?Brad Dwyer
01/28/2023, 1:22 AMSELECT * FROM teams WHERE data#>>'{roles,user1}' IN ('admin', 'guest')
Where data
is a jsonb
column with data structured like this:
{
"name": "Some Example Team"
"roles": {
"user1": "admin",
"user2": "guest"
}
}
My closest attempt is this:
const { data, error } = await supabase.from("teams").select("*").in("data#>>'{roles,user1}'", ["admin", "guest"]);
But I get Token "admin" is invalid. Invalid input syntax for type json.
I've also tried JSON stringifying, appending single quotes around things inside the JS strings, and several other things without success..davdi
01/28/2023, 2:32 AMjs
await supabase.storage.from("avatars").remove(["testuser.jpg"])
Do i need to setup some policies for this? Because earlier worked fine and now i get this error:
json
{"statusCode": "409", "error": "Duplicate", "message": "The resource already exists"}
Lukas
01/28/2023, 2:38 AM3000
01/28/2023, 3:05 AMVince
01/28/2023, 3:35 AMimport { Auth, ThemeSupa } from "@supabase/auth-ui-react"; // this is the Auth component that renders the signin/signup form
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
...
const Signin = () => {
const session = useSession();
const supabase = useSupabaseClient();
...
return (
<div className="container" style={{ padding: "50px 0 100px 0" }}>
<Auth
supabaseClient={supabase}
appearance={{ theme: ThemeSupa }}
theme="dark"
/>
)
</div>
);
};
export default Signin;
Screenshots to show what the rendered component looks like...see attached.lukejamison_
01/28/2023, 4:17 AMundoublethink
01/28/2023, 7:07 AMsql
CREATE TABLE foo (id int, data jsonb);
And I have some data in the table:
1 | [[1, 2], [3, 4]]
2 | [[5, 6], [7, 8]]
Then I query it via the API:
sh
curl 'https://<supabase id>.supabase.co/rest/v1/foo?select=*' \
-H "apikey: SUPABASE_KEY" \
-H "Authorization: Bearer SUPABASE_KEY"
The result is the following JSON:
json
[
{
"id": 1,
"data": "[[1, 2], [3, 4]]"
},
{
"id": 2,
"data": "[[5, 6], [7, 8]]"
}
]
But I would have expected the data
value to be a JSON array? Is this the expected behavior or is there something I am doing incorrectly?
(edit: sorry, the title poorly worded for a help request but I don't think I can change it)