copple
11/23/2021, 7:07 AMjohn654
11/23/2021, 7:09 AManothercoder
11/23/2021, 7:50 AMTiger Abrodi 🐆
11/23/2021, 9:26 AMTiger Abrodi 🐆
11/23/2021, 9:26 AMalmkamberi
11/23/2021, 9:27 AMTiger Abrodi 🐆
11/23/2021, 9:32 AMTerry
11/23/2021, 10:30 AM.eq
on the same field?Terry
11/23/2021, 10:31 AMTerry
11/23/2021, 10:31 AM.eq(css, 4).eq(css, 2).eq(css, 5)
Terry
11/23/2021, 10:31 AM.eq(css, [4,2,5])
syntax?letourpowerscombine
11/23/2021, 11:04 AM"FetchError: XMLHttpRequest is not defined"
when making calls to a SvelteKit endpoint, that sends request to Supabase. Everything works as expected in local development, but fails in deployment on Cloudflage Pages.
I also noticed this issue, https://github.com/supabase/supabase-js/issues/154, which seemed like it might be relevant. I tried doing the createClient
with a defined fetch method — but I'm still encountering the error.
Here's the function that requests the endpoint:
javascript
async function submitForm(e) {
var formData = new FormData(e.target);
formData.append('loaded_address', loaded_address);
formData.append('address', address);
const response = await fetch(`./submitform`, {
method: 'post',
body: formData
})
response.ok ? ( form_submit = "success" ) : (form_submit = "error" )
}
And here's the submitform
endpoint, which requests to Supabase:
javascript
// import supabase from "$lib/db"
import { variables } from '$lib/variables';
import { createClient } from '@supabase/supabase-js'
const supabase = createClient( import.meta.env.VITE_SUPABASE_URL,
import.meta.env.VITE_SUPABASE_ANON_KEY, { fetch: fetch })
export async function post(request) {
const {data, error} = await supabase
.from('support_responses')
.insert({support_info: request.body.get('support_info'), introduction: request.body.get('introduction'), contact: request.body.get('contact'), loaded_location: request.body.get('loaded_address'), searched_location: request.body.get('address')})
if (error) {
return {
status: 500,
body: error
}
}
else {
return {
status: 200,
body: {
data
}
}
}
}
anothercoder
11/23/2021, 11:06 AMTerry
11/23/2021, 11:44 AMletourpowerscombine
11/23/2021, 12:32 PMcustomFetch = someFunction()
, I'm trying to understand what is someFunction()
to make this workAdi
11/23/2021, 12:55 PMbatoms
11/23/2021, 1:27 PMbatoms
11/23/2021, 1:37 PMorganizations
or tenants
table and all of your other tables include a foreign key to tenant table. You would then use row level security and set up a PG policy to filter the results based on which tenant(s) the user is a member of.benjick
11/23/2021, 1:51 PMjohn654
11/23/2021, 2:08 PMAdi
11/23/2021, 2:09 PMTiger Abrodi 🐆
11/23/2021, 2:24 PMTiger Abrodi 🐆
11/23/2021, 2:24 PMTiger Abrodi 🐆
11/23/2021, 2:40 PMTiger Abrodi 🐆
11/23/2021, 2:40 PMTiger Abrodi 🐆
11/23/2021, 2:47 PMTiger Abrodi 🐆
11/23/2021, 2:47 PMTiger Abrodi 🐆
11/23/2021, 2:47 PMchipilov
11/23/2021, 2:49 PM