Ludvig
09/06/2022, 5:41 PM> npm i supabase
changed 1 package, and audited 526 packages in 3s
found 0 vulnerabilities
> npx supabase -h
'supabase' is not recognized as an internal or external command,
operable program or batch file.
I have tried doing it using the global flag too. I have my PATH environment variables set up correctly too, so that's not the issue.
> npm i supabase -g
added 14 packages, and audited 15 packages in 4s
found 0 vulnerabilities
> npm list -g --depth 0
C:\Users\Username\AppData\Roaming\npm
└── supabase@1.4.2
> supabase login
supabase : The term 'supabase' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ supabase login
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (supabase:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
NPM version: 8.3.1
Node version: 17.4.0
Docker version: 20.10.17, build 100c701
OS: Windows 10 Pro (21H2 19044.1949) 64bitjdgamble555
09/06/2022, 6:39 PMcoleretriever
09/06/2022, 10:40 PMmerlo
09/06/2022, 10:58 PMcapezolo
09/06/2022, 11:08 PMjoshcowan25
09/06/2022, 11:42 PMJulien
09/06/2022, 11:52 PMts
supabase
.storage
.from(bucket_id)
.download(path)
Doing this in just 1 request would simplify the client side code and make the content appears all at once instead of having the text to appears and later on the images.
According to this: https://supabase.com/docs/guides/database/extensions/plv8#create-plv8-functions
I can use the JS extension and that will give me access to the supabase object inside database functions? I assume that by looking at the JavaScript example under the sentence: ``You can call plv8 functions like any other Postgres function:``. Is that true? If yes, I will be able to build a database function to select the info from the database & get the raw string from the S3 storage so that would be everything I need.
Otherwise, I suppose that I can do a normal postgresql database function to perform the select and use the HTTP extension to get the raw string from the S3 storage, I just have to grab the get url from the download method (I found it in the node_modules), right?stefikira
09/07/2022, 12:03 AMsupabase functions serve <functionName>
jxyz
09/07/2022, 2:09 AMtry_catch.js
09/07/2022, 3:26 AMRaketa
09/07/2022, 7:01 AMLazyLima
09/07/2022, 8:10 AMmartinffx
09/07/2022, 9:10 AMsupabase start
Everything starts up nicely but I get the following when trying to serve my test function locally:
$ supabase functions serve --debug email-confirmation
Error: unable to upgrade to tcp, received 409
Shibi
09/07/2022, 9:48 AMchaos
09/07/2022, 11:14 AMAaron Me
09/07/2022, 11:51 AMmadsbuch
09/07/2022, 12:48 PMpreview_data.sql
file and try to start the database with following docker-compose service entry:
database:
image: supabase/postgres:latest
ports:
- 5432:5432
command: postgres -c config_file=/etc/postgresql/postgresql.conf
volumes:
- ./data/preview_data.sql:/docker-entrypoint-initdb.d/preview_data.sql
environment:
POSTGRES_PASSWORD: postgres
it fails:
database_1 | [local] 2022-09-07 12:46:16.815 UTC [70] postgres@postgres ERROR: role "supabase_admin" does not exist
database_1 | [local] 2022-09-07 12:46:16.815 UTC [70] postgres@postgres STATEMENT: ALTER SCHEMA auth OWNER TO supabase_admin;
database_1 | psql:/docker-entrypoint-initdb.d/preview_data.sql:26: ERROR: role "supabase_admin" does not exist
preview-infrastructure_database_1 exited with code 3
However, it seems like this role is being set up after files from the docker-entrypoint-initdb.d
folder is being executed. When we use psql postgres://postgres:postgres@localhost -f ./data/preview_data.sql
it works flawlessly!
Anyone with suggestions to getting the file in docker-entrypoint-initdb.d
to work?glen
09/07/2022, 1:13 PMexport default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const payload = {
userId: req.query.user,
exp: Math.floor(Date.now() / 1000) + 60 * 60,
};
const token = jwt.sign(payload, supabaseKey);
return res.status(200).json({ token });
}
Initialize a Supabase client with the access token
export const getSupabase = (access_token: string) => {
const supabase = createClient(supabaseUrl, supabaseAnonKey, {
global: {
headers: {
Authorization: `Bearer ${access_token}`,
},
},
});
return supabase;
};
* Upload file to Supabase storage*
async (file: File) => {
// Get token from NextJs Api route
const response = await fetch(
`http://localhost:3002/api/supabase?user=${user}`
);
const { token } = await response.json();
// Pass token to Supabase client
const supabase = getSupabase(token);
const { data, error } = await supabase.storage
.from(bucket)
.upload(file.name, file);
});
},
Returns
{statusCode: '400', error: 'invalid signature', message: 'invalid signature'}
,Deleted User
09/07/2022, 2:22 PMDevThoughts
09/07/2022, 3:13 PMkresimirgalic
09/07/2022, 3:54 PMconst initClient = useCallback(async () => {
if (window.gapiIsInitialized) return
console.log('init gapi')
return gapi.client.init(GAPI_CONFIG).then(
() => {
// const access_token =
// session.user.identities.find((acct) => acct.provider === 'google')
// ?.access_token ?? ''
if (session?.access_token === '') return
gapi.client.setToken({ access_token: session.access_token })
window.gapiIsInitialized = true
return
},
(e) => {
window.gapiIsLoading = false
console.info('error init gapi client', e.details)
}
)
}, [])
The problem i am getting right now is this one:
message: "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."DemosthenesLocke
09/07/2022, 5:58 PMKelaos
09/07/2022, 6:15 PMeq
and use range
to paginate until we no longer receive data.
However, this is giving us a LOT of duplicates. I've tried chaining range then eq and eq then range and both give us thousands of duplicates.
Any ideas what would be causing this/how to do it better ❓
I took a look at the docs and I don't think we missed anything obvious.
I'm suspicious that it has to do with how Postgres doing things but I can't remember the keywords to look for that
Here's a snippet of the code we're using to retrieve map markers from our DB.
let markerList: Array<any> = [];
let cursor = SUPABASE_MAX_ROWS;
let data;
let index = 0;
do {
data = await supabase
.from('markers')
.select('markers')
.eq('markers->>Cluster Label', cluster)
.eq('version', version)
.eq('status', algorithm)
.range(index, cursor);
index = cursor + 1;
cursor += SUPABASE_MAX_ROWS;
markerList = markerList.concat(data.data);
} while (data.body?.length);
Relisora
09/07/2022, 7:06 PMgsutil
, but to put the folders now in my supabase bucket, I am stuck with the dashboard that times out after uploading a few files.
This maybe because my upload speed is much worse than my download speed.
Is there a way for me to reliably (preferably from CLI) upload those folders to supabase storage?tonyhart
09/07/2022, 7:31 PMalx90
09/07/2022, 7:41 PMpayload.updated_at = new Date()
//OR
payload.updated_at = new Date().toISOString()
//both is not working
Im getting the following error:
{
code: '22007',
details: null,
hint: null,
message: 'invalid input syntax for type timestamp with time zone: "6. September 2022, 17:21"'
}
jxyz
09/07/2022, 9:13 PMjs
const email = 'alice@gmail.com';
const password = 'test1234';
const create_user_response = await supabase.auth.api.createUser({ email, password, email_confirm: true });
I am getting the following error, I am clueless why this happens. Any ideas?
{
user: null,
data: null,
error: {
message: 'duplicate key value violates unique constraint "users_pkey"',
status: 500
}
}
jxyz
09/08/2022, 12:09 AMDanMossa
09/08/2022, 12:38 AMBiscuitCoin
09/08/2022, 1:02 AM.track()
. This could be easy to change your name or id to something fake and be abusive if it isn't tied to an authenticated user. Is there a method of getting the user id of the users present that isn't spoof-able?