Jimmy
01/22/2023, 11:16 AMfachofacho
01/22/2023, 2:32 PMsupabase functions deploy total-hours-spent --debug
output:
Bundling total-hours-spent
Error: Error bundling function: signal: trace/BPT trap
file:///src/import_map.json
file:///src/index.ts
assertion failed [block != nullptr]: BasicBlock requested for unrecognized address
(BuilderBase.h:550 block_for_offset)
it seems that when i remove the imports, the code is bundled as expected.
imports:
import { createClient } from "https://deno.land/x/supabase@1.3.1/mod.ts"
import { serve } from 'https://deno.land/std@0.131.0/http/server.ts'
VuNguyen
01/22/2023, 3:29 PM5
I want these type of value to match:
5 -> true
anystringhere 5 -> true
55 -> false
anystringhere 55 -> false
5 anystringhere -> false
55 anystringhere -> false
Is there any way to achieve that without using rpc?Alaanor
01/22/2023, 3:34 PMsupabase db push
for db migrations which is awesome but what about the edge functions ?lekt9
01/22/2023, 3:53 PMError: The remote database's migration history is not in sync with the contents of supabase/migrations. Resolve this by:
- Updating the project from version control to get the latest supabase/migrations,
- Pushing unapplied migrations with supabase db push,
- Or failing that, manually editing supabase_migrations.schema_migrations table with supabase migration repair.
Try rerunning the command with --debug to troubleshoot the error.
rafael
01/22/2023, 4:21 PM{{ .SiteURL }}/confirm-signup?confirmation_url={{ .ConfirmationURL }}
but the redirect_to is always poiting to my base url.
There is any way to point to eg. {{ .SiteURL }}/completed/ ?
Thanksfast
01/22/2023, 5:00 PMconst session = await supabase.auth.getSession();
const accessToken = session.data.session.access_token;
Server:
// create supabase client
const supabase = createClient(SUPABASE_URL, SUPABASE_SERVICE_ROLE, {
auth: {
autoRefreshToken: false,
persistSession: false
}
});
// identify user
async function getUserFromAccessToken(accessToken, res) {
try {
const supabase_response = await supabase.auth.getUser(accessToken);
return supabase_response.data.user;
} catch(e) {
console.log(e)
res.status(403);
res.send({type: "error", message: "Forbidden!"});
return false;
}
}
UserUNP
01/22/2023, 5:17 PMtsx
export const handler: Handlers<User | null> = {
GET: async (_, ctx) => {
const data = await Supabase.loginUser();
return ctx.render(data);
}
}
where Supabase.loginUser()
basically runs await Supabase.client.auth.getUser()
and returns null
if there's an error.
Handlers in Fresh are ran on the server-side.. i don't really know how to make auth a user like that.UCDFiddes
01/22/2023, 5:21 PMSolemensis
01/22/2023, 5:35 PMHTMHell
01/22/2023, 5:35 PMTristyn
01/22/2023, 6:15 PMalexanderwford
01/22/2023, 6:18 PMCabtn
01/22/2023, 7:57 PMHTMHell
01/22/2023, 8:01 PM54321
and 8000
ports.
perform
net.http_post(
url:='http://localhost:8000/functions/v1/myfunction',
body:='{}'::jsonb
) as request_id;
But I am not receiving the request.
When I use an external URL, it works. (I used beeceptor.com to check)
What is wrong?ven
01/22/2023, 8:44 PMEythor
01/22/2023, 10:29 PMConnectionRefused: Connection refused (os error 111)
at async Object.connect (deno:ext/net/01_net.js:353:46)
at async RedisConnection.#connect (https://deno.land/x/redis@v0.29.0/connection.ts:166:11)
at async RedisConnection.#connect (https://deno.land/x/redis@v0.29.0/connection.ts:196:7)
I have tried a local redis server instance and a deployed instance but I have the same problem with both.
I used the following command to host to function locally
supabase functions serve redisTest
I tried running the connection command directly with deno and then I had to add --allow-net
parameter and then it to worked well, can I somehow add that parameter to the edge function?
The code I am using inside the function looks like this
`import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
import { connect } from 'https://deno.land/x/redis/mod.ts';
serve(async (req) => {
const { param } = await req.json();
const redis = await connect({
hostname: "localhost",
port: 6379,
});
const value = await redis.get(param);
const data = {
message: ${param} is ${value}
,
}
return new Response(
JSON.stringify(data),
{ headers: { "Content-Type": "application/json" } },
)
})`
Do you know what I might be doing wrong?RevUp
01/22/2023, 10:30 PMCardoso
01/22/2023, 11:03 PMconst addReview = async (review: Omit<Review, "created_at" | "updated_at">, stayId: string) => {
const { data, error } = await supabaseClient
.from<"reviews", Reviews>(REVIEWS_TABLE_NAME)
.insert({ ...review, stay_id: stayId })
.select()
.single();
It is the same code as another insert i have for another table. for the other table is OK but for this i have this strange error.
no RLS and same error removing the select() + single()Drew
01/22/2023, 11:52 PMsean.s
01/23/2023, 12:11 AMAuth
library, but I'm not really sure how to investigate further.
Here's a video demo'ing the behavior. Happy to share the code diff from the example as well if that's helpful.codeless_tinker_bot
01/23/2023, 2:07 AMQueueBot
01/23/2023, 2:27 AMADDITIONAL_REDIRECT_URLS='http://localhost:3000'
and that doesn't seem to work when I call client.auth.signInWithOTP({email: email, options: {emailRedirectTo: 'http://localhost:3000'}})
(it just redirects to the base SITE_URL
). Thoughts?Cody
01/23/2023, 4:07 AMauth.users
table is updated. Specifically when I update the auth.users
email
, I would like it to update the email
column within public.profiles
. I have an RLS policy on public.profiles
that only allows an authenticated user to update their own profile. When when the trigger runs the function:
sql
begin
update public.profiles set email = new.email
where new.id = id and email != new.email;
return new;
end;
When the trigger runs, I get the following error in my logs
Database error updating user for recovery: ERROR: permission denied for table profiles (SQLSTATE 42501)
What would be the best way to do this?CMG
01/23/2023, 5:06 AMcohlar
01/23/2023, 6:00 AM2XX
status, I am unable to read the data returned by the API with the supabase client.
My some-api-proxy
function looks like this (I have removed CORS-related code for simplification):
ts
import { serve } from 'https://deno.land/std@0.168.0/http/server.ts';
const someApiKey = Deno.env.get('SOME_API_KEY');
serve(async (req) => {
try {
if (!someApiKey) {
return new Response(JSON.stringify({ message: 'Some API key not configured.' }), { headers, status: 500 });
}
const { path, params, init } = await req.json();
const response = await fetch(`https://api.some.com/${path}?${new URLSearchParams({ ...params, key: someApiKey })}`, init);
const data = await response.json();
return new Response(JSON.stringify(data), { headers, status: response.status, statusText: response.statusText });
} catch (error) {
return new Response(error.message, { headers, status: 400 });
}
});
And I am calling the edge function with the supabase client as follows:
ts
const body = { path: 'somePath', params: someParams, init: someInit };
const { data, error } = await supabase.functions.invoke('some-api-proxy', { body: JSON.stringify(body) });
if (error) {
// Here I have access to the error context (of type Response), i.e. status, statusText
// But I cannot access the data itself. I have tried `await error.context.json()`, the promise never seems to resolve
};
// Here I have access to the data as long as status code is 2XX
Some APIs have token buckets, and return meaningful data together with the error, such as how many tokens remain and at what rate those tokens refill.rinorzk
01/23/2023, 7:35 AMjs
const { data, error } = await supabaseClient
.from<RoomMessage>("room_messages")
.select("*, profile: profiles(username), replyOf: reply_id(content)")
.eq("room_id", roomId)
.order("created_at", { ascending: true });
I was wondering if I can have something similar when getting the new payload from the subscription? ThanksIdkWhatever69
01/23/2023, 7:41 AMeggnog.
01/23/2023, 7:45 AMdart
supabase.from('users')
.insert({
'email': email,
'display_name': displayName,
});
this is literally what im running and it seems to be getting skipped over as there is never an error thrown and the code directly after runs perfectly fine... RLS policy shouldn't be an issue as I know that is set up as I need it and also it would throw an error anyway if I was running into that.Lois
01/23/2023, 8:38 AM