chip
chip
Explore posts from servers
CDCloudflare Developers
Created by chip on 7/16/2024 in #general-help
Cloudflare SaaS custom hostname 525
Hi. I'm trying to test out Cloudflare SaaS with custom hostnames for a new feature of mine. I'll write out what I've currenlty done. 1. Created a fallback origin https://proxy-fallback.fivemanage.com/. This is an A record to a IP where the page is running on a caddy webserver. 2. Created a CNAME customers to proxy-fallback.fivemanage.com . 3. Created a custom hostname whitelist.error-interactive.com that is a CNAME record to customers.fivemanage.com. FYI: In this case both domains go through CF and all the records mentioned here are proxied. Now, if I go to the fallback domain, we see the webpage, if I go through whitelist.fivemanage.com, its just a 525 handshake error. I've tried to enable Total TLS with Google Trust Services, without that working - disabled again. Am I missing some certificates? I have not touched anything related DCV. Neither did I add any TXT records for error-interactive.com domain. Could it be related to Caddy? (I'm open to change to anything else if need be). Would be great if someone could give some pointers. (Scream at me if I'm duplicating a post, couldn't find any) 🙂
15 replies
CDCloudflare Developers
Created by chip on 3/3/2024 in #workers-help
Count how many times a r2 file has been viewed/downloaded with GET req's
Hi! I'm currently working on a a feature that allows user to enable auto-deletion of files if the image has been viewed less than x amount of times over a certain period. All I really want to do in my worker is to listen to a GET req from any file in my bucket and and simply increment a counter in my database with the image url/id. Then I'll spin up a cron job on Vercel which handles the deletion. I have currently only made a binding between my worker and my r2 bucket, and I tried a simple test with just redirecting any requests back to my homepage, but when I try to access a file in my bucket, it shows the image, instead of redirecting, and nothing is logged either. Am I thinking about this the wrong way? Are these requests only on the worker url, and in that case, should I move my entire uploading logic to the worker, instead of having it running on a separate Go server?
3 replies
TTCTheo's Typesafe Cult
Created by chip on 2/18/2024 in #questions
Input components for log searching / multiselect
Does anyone know of any good or just know of some libraries outside of react-select that could help with creating an input for log searching. Think about Vercel's log searching, or Datadag 🙂
5 replies
DTDrizzle Team
Created by chip on 2/5/2024 in #help
CAST(<json column> with LIKE seems to be buggin
Hey! Having some issues with Drizzle and Planetscale while trying to search through a json column.
return query.where(sql`CAST(${logs.metadata} AS CHAR) LIKE '%${metadata}%'`);
return query.where(sql`CAST(${logs.metadata} AS CHAR) LIKE '%${metadata}%'`);
I 've got something like this, althought when running it it seems to fail on me (see error below):
Query: select `id`, `userId`, `teamId`, `level`, `severity`, `message`, `timestamp`, `metadata`, `resource` from `logs` where (`logs`.`teamId` = ? or CAST(`logs`.`metadata` AS CHAR) LIKE '?') order by `logs`.`timestamp` DESC limit ? -- params: ["UzuZFCpJcZRDB2fCtfJbk", "checking", 100]

web:dev: ⨯ ../node_modules/.pnpm/@planetscale+database@1.7.0/node_modules/@planetscale/database/dist/index.js (78:18) @ Connection.execute
web:dev: ⨯ DatabaseError: syntax error at position 213 near 'checking'
Query: select `id`, `userId`, `teamId`, `level`, `severity`, `message`, `timestamp`, `metadata`, `resource` from `logs` where (`logs`.`teamId` = ? or CAST(`logs`.`metadata` AS CHAR) LIKE '?') order by `logs`.`timestamp` DESC limit ? -- params: ["UzuZFCpJcZRDB2fCtfJbk", "checking", 100]

web:dev: ⨯ ../node_modules/.pnpm/@planetscale+database@1.7.0/node_modules/@planetscale/database/dist/index.js (78:18) @ Connection.execute
web:dev: ⨯ DatabaseError: syntax error at position 213 near 'checking'
Is this a drizzle or planetscale thing, and does anyone know if I'm doing some terribly wrong? 😄
3 replies
TTCTheo's Typesafe Cult
Created by chip on 2/4/2024 in #questions
What to use for storage of logs from SaaS
Yo! I am building a SaaS for game servers, and I want to provide logging as well. I have currently been pepega and stored some simple logs in my database while testing, but with more complex data and search, it's not going to scale nor work very well in the long run. I've been looking at both stuff from Elasticsearch and Algolia, but does anyone have any other services that might be worth looking into? 🙂
5 replies
TTCTheo's Typesafe Cult
Created by chip on 10/26/2023 in #questions
Http cancellation with Vite proxy server not picked up by backend
I've been trying to figure out why my backend wont' pick up http reqs canceled by the frontend, and I've realized that it is because of Vite proxy server:
export default defineConfig({
plugins: [react(), mkcert()],
build: {
outDir: "../server/server/dist",
emptyOutDir: true,
},
base: "/",
resolve: {
alias: {
"@": "/src",
},
},
server: {
open: true,
port: 3000,
proxy: {
"^/api": {
target: devProxyServer,
changeOrigin: true,
},
},
},
});
export default defineConfig({
plugins: [react(), mkcert()],
build: {
outDir: "../server/server/dist",
emptyOutDir: true,
},
base: "/",
resolve: {
alias: {
"@": "/src",
},
},
server: {
open: true,
port: 3000,
proxy: {
"^/api": {
target: devProxyServer,
changeOrigin: true,
},
},
},
});
This only happens in dev locally, as the frontend is hosted in the backend in prod, but has anyone else encountered the same thing and able to give some pointers? I'm at the point where I just want to figure it out 😛 PS: Calling fetch with the absolute path to the backend works (backend picks it up), but not something we can do 😦
2 replies
TTCTheo's Typesafe Cult
Created by chip on 2/27/2023 in #questions
[next-auth] Updating user model with new values after oauth signin
Maybe someone can give some pointers on this Let's say we have this flow 1. User tries to access an protected route 2. Is redirected to /login with an callbackUrl for the protected route and isSubmitting url query 3. Chooses to login with an oauth provider with the same callbackUrl as when they were redirected to /login After/or inbetween they login in with an oauth provider, I want to set a column in the User model ("role") to "some value" based on the "isSubmitting" url query Does anyone know how one could accomplished that? Right now, I've been thinking about creating another route where the user is redirected to after login, grab the callbackUrl, which then would look something like "/afterlogin?callbackUrl=url&isSubmitting=true", but if this is supposed to work, the callbackUrl on the "signIn" function would also look odd, as it would be a callbackUrl with a callbackUrl inside of it 😄 That seems a bit ehh? Any ideas?
4 replies
TTCTheo's Typesafe Cult
Created by chip on 1/28/2023 in #questions
Clerk auth
Curious to hear what people have to say about Clerk, and if anyone have experienced any issues, or challenges while using it. Mainly for Expo now. I am looking into it now that I want more auth providers other than just email/password, and I want to hear from someone how's been using it for a while 🙂
1 replies
TTCTheo's Typesafe Cult
Created by chip on 1/15/2023 in #questions
JWT and refresh tokens
I need some advice on how to handle refresh tokens 😦 Is it "good enough" if I generate two JWT tokens (accessToken, refreshToken), and let the resfrehToken just contain one claim, being the userID? And whenever I do a api call from the client and it returns a 401, I then call a /refresh api call, to get a new accessToken and retry the request - as long as the refreshToken is valid?
26 replies