DisamDev
02/18/2023, 7:04 PMalpha_
02/18/2023, 7:13 PMHolland
02/18/2023, 7:27 PMEidur
02/18/2023, 8:13 PMsql
select * from public."products"
where ("shopPrices"->>'productWholesalePrice')::numeric > 500;
This works exactly as expected. Finds one product that has the exact price of 51.05.
js
const products = await supabase
.from('products')
.select('*')
.eq('shopPrices->>productRetailPrice', 51.05);
This does not work. It finds a bunch of products with price lower than the specified 500.
js
const products = await supabase
.from('products')
.select('*')
.gt('shopPrices->>productRetailPrice', 500);
I'd appreciate any help ❤️yayza_
02/18/2023, 8:44 PMNeil Savin
02/18/2023, 9:34 PMcode
parameter sent to the redirect URL, as well as pass through the state
parameter.
2) A token endpoint, that takes in the authorization code, decodes it, and send back the access token and refresh token.
I can’t find any resources on how to do this… especially for generating an access_token for user on commands. Do you have an idea on how to solve this ?Poutine Italienne
02/18/2023, 10:34 PMsql
select * from pgsodium.create_key();
in the SQL editor of my project
However when I attempt to run the following (in the sql editor of my project)
sql
SECURITY LABEL FOR pgsodium
ON COLUMN server_settings.sftp_password
IS 'ENCRYPT WITH KEY ID MY_UUID_KEY_HERE';
I get the following SQL error
Failed to run sql query: must be owner of event trigger pgsodium_trg_mask_update
I guess I'm doing something wrong but I'm not too sure what.
Thanks a lot.mjs
02/18/2023, 10:36 PMSELECT companies.*
FROM companies
LEFT JOIN company_admins ON companies.id = company_admins.company_id
LEFT JOIN company_members ON companies.id = company_members.company_id
WHERE company_admins.user_id = <logged_in_user_id>
OR company_members.user_id = <logged_in_user_id>;
I'm not using SSR, so I'm just using useEffect
and useState
to set local UI state when data is fetched.
ThanksHypersigils
02/18/2023, 10:38 PMconst { data, error } = await supabase
.storage
.from('maps')
.createSignedUrl(map.src, 600);
https://i.imgur.com/uBuVolf.png▾
https://i.imgur.com/JBKotQU.png▾
https://i.imgur.com/uzl3qN9.png▾
DYELbrah
02/18/2023, 10:54 PMconst ssg = createProxySSGHelpers({
router: appRouter,
ctx: createTRPCContext({
req: context.req as NextApiRequest,
res: context.res as NextApiResponse,
}),
transformer: superjson,
});
I'm using the createTRPCContext from create T3 app.
Is this okay to do? I have to pass the req and res from the context because I have a Supabase server client in the background that needs that information:
export const createTRPCContext = (_opts: CreateNextContextOptions) => {
const supabase = createServerSupabaseClient<Database>({
req: _opts.req,
res: _opts.res,
});
return createInnerTRPCContext({
supabase,
});
};
JH175
02/19/2023, 12:28 AMDrip
02/19/2023, 1:31 AMCrownie
02/19/2023, 1:39 AMUnknown Member
02/19/2023, 2:11 AMIgnoreOnInsert
it works on the Supabase side of things, as I expected the timestamps to be generated there. However, when the Postgresql client returns the ModeledResponse
, the columns marked with the said attributes are blank. screenshots are included below P.S Ty for making this client I am learning so much about C#!!!!! ❤️moarwick
02/19/2023, 2:56 AMawait supabase
.from("vendors")
.update({ expense_category_id: expenseCategoryId })
.eq("id", id)
.select();
The vendors
table has a RLS Policy for UPDATE: (auth.uid() = user_id)
The returned record is unmodified. Anything I could be missing??jar
02/19/2023, 3:10 AMconst response = await fetch('/api/user', {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + session?.access_token
}
});
My server component in +server.js in sveltkit looks like this
import { createClient } from '@supabase/supabase-js'
import { env } from '$env/dynamic/public';
export async function GET(event) {
try {
console.log('getUserData')
const authHeader = event?.request?.headers?.get('Authorization')
console.log('authHeader',authHeader)
if(!authHeader){
return new Response(JSON.stringify({ message: 'No Authorization Token Provided'}, { status: 401 }))
}
const supabaseClient = createClient(env.PUBLIC_SUPABASE_URL, env.PUBLIC_SUPABASE_ANON_KEY, {
auth: {
autoRefreshToken: false,
persistSession: false,
detectSessionInUrl: false
}
})
const res = await supabaseClient.auth.getUser(authHeader)
console.log('userres',res)
successfully prints jwt and i want to get the user sub and login as user but user res says
userres {
data: { user: null },
error: AuthApiError: This endpoint requires a Bearer token
at /node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:41:20
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
__isAuthError: true,
status: 401
}
}
jar
02/19/2023, 3:22 AMlaubonghaudoi
02/19/2023, 4:01 AM<->
operator is from pg_trgm
extension, I know I can write a rpc function call or order my query results by distance. But I like to use .order()
directly in JavaScript. is it possible to do so? I checked the doc and this isn't mentioned https://supabase.com/docs/reference/javascript/orderSmiley
02/19/2023, 4:21 AMGitanes
02/19/2023, 5:44 AMbilals
02/19/2023, 6:39 AMNaviz
02/19/2023, 7:22 AMfull_name, phone, user_group.group_id
)
.leftJoin('user_group', 'users.id', 'user_group.user_id')
.eq('user_group.group_id', group_id)
if (error) {
throw error;
}` Como puedo crear esa consulta? intenté crear una view pero no puedo hacerlo dinamico. ayudaaa!!Avinier
02/19/2023, 7:32 AMexport default function Home() {
const [fetchedData, setFetchedData] = useState(null);
useEffect(() => {
async function fetchData() {
try {
let { data: cardata, error } = await supabase
.from("Cardata")
.select("*");
if (error) {
console.log(error);
}
if (data) {
setFetchedData(data);
console.log(cardata);
}
} catch (err) {
console.log(err);
}
}
fetchData();
}, []);
return <h1>WELCOME</h1>
and the console (no errors, just an empty array)ioTactile
02/19/2023, 10:12 AMBlob
02/19/2023, 11:28 AMBritish Dominic
02/19/2023, 11:31 AMPoutine Italienne
02/19/2023, 11:56 AMjs
supabase.client
.from('servers')
.select(`
server_name,
server_settings (
sftp_ip,
sftp_port,
pgp_sym_decrypt(sftp_password::bytea, '${env.SUPABASE_ENCRYPTION_KEY}')
)`
)
Using `pgp_sym_decrypt(sftp_password::bytea, '${env.SUPABASE_ENCRYPTION_KEY}')`in my select statement causes the following error. Removing the single quote also causes an error.
An error occurred while fetching server settings {
code: 'PGRST100',
details: `unexpected "'" expecting field name (* or [a..z0..9_$]) or "*"`,
hint: null,
message: `"failed to parse select parameter
What's the correct way of decrypting a field using pgcrypto in with the javascript SDK?
Thank you in advancemelkotoury
02/19/2023, 12:06 PMMaxAryus
02/19/2023, 12:35 PMLappp
02/19/2023, 1:14 PMnpm install
locally
2. But I seem to keep getting this error, logs are below.
Stuff that I've tried.
1. Thought it was an npm cache
issue, ran npm install --cache ./temp-cache
to test, but it still gets stuck here.
2. Reinstalled VS Build Tools 2019 , as I read somewhere that node-gyp needs it so I thought a fresh installation might help.
3. Run npm install -g node-gyp
and it installs successfully and I can get its version, but npm install
still fails there.
Any ideas?