Acro
Acro
Explore posts from servers
CDCloudflare Developers
Created by Acro on 4/7/2025 in #general-help
My website is not even setup yet: 522, but got 90k requests in past 30 days?!
Was just checking my domain on Cloudflare and it says I got 90k requests in the past 30 days? I am assuming this is all probably bot traffic. its a made up word domain that doesn't mean anything at the moment, but going to be used as a SaaS. Is there any way to mitigate this? I am just thinking when I do get my service up and have Cloudflare CDN Cloudflare R2 for images on the website. Wouldn't this wipe nearly all free tier? I don't want to pay for traffic from all these bots.
3 replies
BABetter Auth
Created by Acro on 4/6/2025 in #help
Clarification on Email OTP Auth Flows
I am not clear on the flows of the Email OTP auth flows. 1. SignIn with OTP - I have regular credentials setup. Seems like it replaces the password in credentials? And I would have only an email field with a button Sign In with Passcode? Or does this happen in addition to password kinda like two-factor auth without the twoFactor plugin. 2. Verify Email - self explanatory. Sent on Sign Up, user auto Signed In. Authenticated Form to input OTP and resend verification email button. 3. Reset Password - Is this for currently logged out user it seems? Reset password form with just email field. This email gets sent with the OTP and a link to your public password change password form: otp, email, new password, confirm new password? I'm generally familiar with reset links. But I think somewhere in OWASP, OTP are recommended. I guess I can opt out of any of these just by not providing the function. I don't know th use case of SignIn with OTP for instance.
3 replies
BABetter Auth
Created by Acro on 2/24/2025 in #help
Server API: No Get Active Organization?
https://www.better-auth.com/docs/plugins/organization#use-active-organization Seems likes getting the user's active organization is only available on client side and not with the server api?
9 replies
BABetter Auth
Created by Acro on 2/9/2025 in #help
SvelteKit Example
I was planning to do auth path check in hooks.server.ts, but don’t think I can with the svelteKitHandler So looks like what I need to do for SvelteKit, is do this on the root layout.server.ts and pass the session down. await parent() And do path check on each page or layout with the session passed down. I hope there is a way to use the auth.api in hooks.server.ts instead. I planned on assigning the auth.api to event.locals Cause I’m assuming you can’t use the auth.api before the svelteKitHander. Inspired by: https://youtu.be/K1Tya6ovVOI?feature=shared Would love an example of this with Better Auth.
9 replies
TTCTheo's Typesafe Cult
Created by Acro on 10/8/2024 in #questions
T3 Env: Unconventional Setup: SvelteKit + Payload CMS
Turborepo 1. Frontend: SvelteKit - Node Adapter > build artifact in backend folder 2. Backend: Payload CMS v3 - Next.js Custom Express Server -> /admin route handled by Next.js, all other routes handled by handler.js build artifact by SvelteKit. Running backend dev (Next.js) admin - no ENV issues. It has its own .env on its root. Frontend running dev - Importing my payload.config.ts from backend to SvelteKit to make local API calls gives Required issue on all ENV variables. Meaning it isn't detecting any ENV variables. I have a .env file in root of SvelteKit. console.log() env variables and they show up. SvelteKit file that reaches outside of its project folder to get payload.config.ts from backend. The payload.config.ts references the env.MY_VARIABLE
import { type BasePayload, getPayload } from 'payload';
import config from '../../../backend/src/payload.config'

let payloadInstance: BasePayload;

export async function initializePayload() {
payloadInstance = await getPayload({ config })
}
import { type BasePayload, getPayload } from 'payload';
import config from '../../../backend/src/payload.config'

let payloadInstance: BasePayload;

export async function initializePayload() {
payloadInstance = await getPayload({ config })
}
My createEnv is at backend/src/env.ts How do I get @t3-oss/env-core to find env files like this? @t3-oss/env-core is only installed on backend. Do I need it in frontend (SvelteKit) as well? Just tried this, didn't work...
2 replies
DTDrizzle Team
Created by Acro on 3/21/2024 in #help
Examples for Error Handling?
I am looking through docs on how to handle DB errors, but not finding a list of error codes. For example, UNIQUE or NOT NULL constraints to check for. Or is this something I need to look at Postgres.js docs for? Pseudocode below using Sqlite, but want to know for Postgres.js
try {
...
} catch (e) {
if (e instanceof SqliteError && e.code === "SQLITE_CONSTRAINT_UNIQUE") {
return setError(form, 'email', "E-mail already used")
}
}
try {
...
} catch (e) {
if (e instanceof SqliteError && e.code === "SQLITE_CONSTRAINT_UNIQUE") {
return setError(form, 'email', "E-mail already used")
}
}
2 replies
DTDrizzle Team
Created by Acro on 3/21/2024 in #help
When to use what? drizzle-kit push:* Vs. having a file with drizzle migrate client?
Option 1: package.json script drizzle-kit push:pg Option 2: migrate.ts script
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';

const migrationClient = postgres("postgres://postgres:[email protected]:5432/db", { max: 1 });
migrate(drizzle(migrationClient), ...)
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';

const migrationClient = postgres("postgres://postgres:[email protected]:5432/db", { max: 1 });
migrate(drizzle(migrationClient), ...)
6 replies
CDCloudflare Developers
Created by Acro on 12/27/2023 in #pages-help
Cloudflare Pages + TurboRepo + PNPM
I have deployed one of my apps successfully to Vercel (so I know nothing wrong with my apps) I want to deploy on Cloudflare Pages, I get this Error: npm ERR! code EUNSUPPORTEDPROTOCOL. Which makes a lot of sense. as I specified in the root package.json as pnpm to be my packageManager. Even though I set my build command correctly. Cloudflare Pages still always runs Installing project dependencies: npm install --progress=false, before my actual build command. So it fails, as I restricted it to only allow pnpm. Why does Cloudflare pages assumes npm by default? Doesn't seem a way to disable it... I am on Build System Version: 2
27 replies