SickRussel
06/17/2022, 8:44 PMgaryaustin
06/17/2022, 8:46 PMZenon
06/19/2022, 2:11 PM_middleware.js
fileZenon
06/19/2022, 2:13 PMjs
import { supabase } from "@/config/index";
import { NextResponse } from "next/server";
export async function middleware(req) {
const { user } = await supabase.auth.api.getUserByCookie(req);
if (!user) return NextResponse.redirect("/auth/login");
return NextResponse.next();
}
supabase
is simply a supabase client created using the createClient function.Zenon
06/19/2022, 2:14 PMgaryaustin
06/19/2022, 2:30 PMjuanzitelli
06/20/2022, 6:28 AMsilentworks
06/20/2022, 6:41 AMBig Bird
06/20/2022, 10:50 AMshortlisted_talents
with a column called talent_ids
which is an array of int8's.
I understand how I add values to that array. But what if I only want to append / push a single value to it, without overwriting previous values?garyaustin
06/20/2022, 6:37 PMjJ
06/20/2022, 10:59 AMjavascript
let query = supabase
.from<models.ArticleDocument>('articles')
.select('*, calendar(start_at)')
.order('start_at', { foreignTable: 'calendar', ascending: false })
any ideas how I can do this? Kind regards jJBig Bird
06/20/2022, 11:01 AMjJ
06/20/2022, 11:02 AMBig Bird
06/20/2022, 11:04 AMBig Bird
06/20/2022, 11:05 AMlet query = supabase
.from<models.ArticleDocument>('articles')
.select(`*, calendar(start_at)`)
.order('start_at', { foreignTable: 'calendar', ascending: false })
jJ
06/20/2022, 11:05 AMBig Bird
06/20/2022, 11:06 AMjJ
06/20/2022, 11:08 AMBig Bird
06/20/2022, 11:09 AMjJ
06/20/2022, 11:09 AMjJ
06/20/2022, 11:09 AMgaryaustin
06/20/2022, 6:37 PMrommyarb
06/21/2022, 4:00 AMlimit(1)
before single()
method? Thx.
javascript
const { data } = await supabase
.from<Profile>('profiles')
.select()
.match({ id: userId })
.limit(1) // is this necessary?
.single();
garyaustin
06/21/2022, 4:14 AMgaryaustin
06/21/2022, 4:20 PMgaryaustin
06/21/2022, 4:20 PMDevr
06/22/2022, 11:16 AMsilentworks
06/22/2022, 11:51 AMhatton
06/22/2022, 5:19 PMcreateClient
, and do not get a useful error back.
import { serve } from "https://deno.land/std@0.131.0/http/server.ts";
import { createClient } from "https://deno.land/x/supabase@1.3.1/mod.ts";
serve(async (req) => {
try {
const supabase = createClient(
Deno.env.get("SUPABASE_DB_URL")!,
Deno.env.get("SUPABASE_ANON_KEY")!
);
return new Response("Successfully created client");
} catch (error) {
return new Response(
JSON.stringify({
error_name: error.name,
error_message: error.message,
stack: error.stack,
})
);
}
});
We then test this with
supabase functions deploy report-font-use --no-verify-jwt
curl -L -X POST 'https://<OURPROJECTREF>.functions.supabase.co/report-font-use'
The result is
{
"error_name": "TypeError",
"error_message": "Cannot read properties of undefined (reading 'href')",
"stack": "TypeError: Cannot read properties of undefined (reading 'href')\n at getParameterByName (file:///src/main.ts:389:37)\n at new GoTrueClient (file:///src/main.ts:869:61)\n at new SupabaseAuthClient (file:///src/main.ts:1377:9)\n at SupabaseClient._initSupabaseAuthClient (file:///src/main.ts:3130:16)\n at new SupabaseClient (file:///src/main.ts:3070:26)\n at createClient (file:///src/main.ts:3176:12)\n at Server.<anonymous> (file:///src/main.ts:3180:9)\n at Server.#respond (file:///src/main.ts:110:43)\n at Server.#serveHttp (file:///src/main.ts:131:26)"
}
As I say, pretty stuck. Can someone point out what we're missing?Günhan
06/23/2022, 7:50 AM