omri
09/05/2022, 9:54 AMcreated_at
column by default, why is it nullable even though it has a default value of now()
?lampaboy
09/05/2022, 11:13 AMconst { subscription } = supabase.auth.onAuthStateChange(
(_event, session) => {
setSession(session)
}
)
with this error, Property 'subscription' does not exist on type '{ data: { subscription: Subscription; }; }'.",
This can be found under Launch.js
here https://supabase.com/docs/guides/with-nextjs#launchSETY
09/05/2022, 12:02 PM49Ryann
09/05/2022, 1:36 PMShin Miyagi
09/05/2022, 2:48 PMgetServerSideProps
. However I only seem to be able to load the page for logged in users or redirect if they are not logged in as per https://github.com/supabase/auth-helpers/blob/main/packages/nextjs/README.md (Server-side rendering (SSR) - withPageAuth).
I did find this https://github.com/supabase/auth-helpers/issues/109 where someone suggests to use authRequired: false
, but whilst that does load the page without the user being logged in, if the user is not logged in it does not pass through the props. I am passing through critical data in getServerSideProps so that's no good.
I created this test page:
...
export const getServerSideProps = withPageAuth({
authRequired: false,
async getServerSideProps(ctx) {
const { user } = await getUser(ctx);
const message = "Some message"
if (user) {
return {
props: {
message: "User authenticated"
}
};
}
else {
return {
props: {
message: "User not authenticated"
}
};
}
}
});
If the user is logged in, message
makes it through to props. If the user is not logged in message
does not get through to props, all I get is a null user object.
Is there a way for me to check for the user SSR, if the user exists do some stuff, and then pass the rest of the data I am processing SSR through props to the app?Omni
09/05/2022, 2:59 PMinsert({...}).select().single();
Julien
09/05/2022, 3:37 PMts
supabase
.from('playground')
.select(`
photos:playground_photos(
photo(*)
),
`).eq('id', playgroundId)
.single()
This request returns a data object with the following structure:
ts
{
photos: [
{
photo: {...}
},
{
photo: {...}
}
]
}
Is this possible to flatten that like so:
ts
{
photos: [
{
...
},
{
...
}
]
}
So that I don't get an extra photo property? Without doing a for loop but directly in the query string of the select?Jinni
09/05/2022, 4:22 PMsupabase.from("characters").select().then((response) => {
console.log(response)
})
JTmaveryk
09/05/2022, 5:57 PMowonwo
09/05/2022, 5:58 PMgbb
09/05/2022, 6:25 PMKieran Gill
09/05/2022, 6:36 PMRelisora
09/05/2022, 7:30 PMERROR: could not write to file "base/pgsql_tmp/pgsql_tmp<hash>": No space left on device
I have the pro subscription and my db usage is 6.2GB/8GB.
How can I fix this?DevThoughts
09/05/2022, 7:36 PMweilzuvielgewalt
09/05/2022, 7:50 PMAmusedGrape
09/05/2022, 10:56 PMn10000k
09/05/2022, 11:30 PMdisabled = true
, then i want to insert that record into another table. thanks in advancejxyz
09/05/2022, 11:44 PMVengeance
09/06/2022, 1:01 AMd33pu
09/06/2022, 6:47 AMboeledi
09/06/2022, 7:01 AMFunctionResponse? res;
final String? accessToken = Supabase.instance.client.auth.session()?.accessToken;
try {
res = await Supabase.instance.client.functions.invoke(
'ef_authentication_test',
body: {
"action": "action",
"data": {
"hello": "worled",
},
},
headers: {'Authorization': 'Bearer $accessToken'},
);
TraceHelper.logE('[SupabaseHelper::invokeFunction] -- Response', error: res);
} catch (e) {
TraceHelper.logE('[SupabaseHelper::invokeFunction] -- Exception', error: e);
}
The call invocation works, the exists.
At the level of the Edge Function, I am running the following:
export const supabaseClient = createClient(
// Supabase API URL - env var exported by default when deployed.
'https://KEY.supabase.co',
// Supabase API ANON KEY - env var exported by default when deployed.
'<ANON KEY>'
);
export function supabaseUser(req:Request) {
// Get the authorization header from the request.
const authHeader = req.headers?.get('Authorization')?.replace("Bearer ", "") || "";
console.log(`Authorization: ${authHeader}`);
supabaseClient.auth.setAuth(authHeader);
console.log(`User: ${supabaseClient.auth.user()}`);
return supabaseClient.auth.user();
};
The corresponds to the from the client side.
The I am getting is always NULL. => I need to get this to validate the requestor.
Could anybody tell me what I am doing wrong?
Thanks in advance,draco
09/06/2022, 8:19 AMwhiskeywizard
09/06/2022, 9:29 AMgorbypark
09/06/2022, 11:23 AMupdate()
is not returning any data and the docs say by default it returns the updated record. Also, the returning property does not seem to exist as per the docs. .update({val: 123}, {returning: 'representation})
and TS complains that only count
is valid. The data is actually being updated in the database. In the below code, the if (data) {}
condition never fires, and the first console.log always returns undefined. If i force an error, error is working as expected.
js
const { data, error } = await supabase.from('inventory').update(newRow).match({ id: newRow.id })
console.log('data below await', data)
if (data) {
console.log('data from inside conditional', data)
}
if (error) {
console.log('error!', error)
}
rbkayz
09/06/2022, 12:08 PMgbb
09/06/2022, 12:18 PMgwaiLoFi
09/06/2022, 3:07 PMHoneyandtoast
09/06/2022, 3:31 PMHand0fThrawn
09/06/2022, 3:44 PMgwaiLoFi
09/06/2022, 4:34 PMyarn
3. yarn dev
yarn dev fails with missing types warning, suggests`yarn add --dev @types/react @types/node`
4. install node + react types
5. run yarn dev
continuously get this error:
It looks like you're trying to use TypeScript but do not have the required package(s) installed.
Please install @types/react and @types/node by running:
yarn add --dev @types/react @types/node