x03
x03
Explore posts from servers
CDCloudflare Developers
Created by x03 on 9/3/2024 in #general-help
Issues with R2 signed URLs (403 Forbidden)
No description
14 replies
CDCloudflare Developers
Created by x03 on 8/10/2024 in #general-help
CF-CONNECTING-IP Header being excluded from "bot fight mode" triggers
I have a website that recieves very large amounts of traffic, and recently I've had a very few amount of users report issues with authentication. After debugging, I realized that Cloudflare's IP header was not being passed for those people. Looking at their requests in Security Events, they seem to lack a user agent and are listed under the "Managed challenge" action for the "Bot fight mode" service. To test my theory, i turned off bot fight mode and those users were able to use the app fine. My question is, how can I keep bot fight mode enabled while still allowing people who manage the challenge to keep their cf-connecting-ip header.
2 replies
DTDrizzle Team
Created by x03 on 7/25/2024 in #help
Issues deploying with Dockerfile
I'm using SvelteKit, and I run my migrations on app start in hooks.server.ts After building with Dockerfile, I get these runtime errors nonstop:
Node.js v18.20.4
file:///app/node_modules/drizzle-orm/migrator.js:19
throw new Error(`Can't find meta/_journal.json file`);
^

Error: Can't find meta/_journal.json file
at readMigrationFiles (file:///app/node_modules/drizzle-orm/migrator.js:19:11)
at migrate (file:///app/node_modules/drizzle-orm/postgres-js/migrator.js:3:22)
at file:///app/build/server/chunks/hooks.server-ypJT85G1.js:31:1
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.20.4
file:///app/node_modules/drizzle-orm/migrator.js:19
throw new Error(`Can't find meta/_journal.json file`);
^

Error: Can't find meta/_journal.json file
at readMigrationFiles (file:///app/node_modules/drizzle-orm/migrator.js:19:11)
at migrate (file:///app/node_modules/drizzle-orm/postgres-js/migrator.js:3:22)
at file:///app/build/server/chunks/hooks.server-ypJT85G1.js:31:1
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Here's my Dockerfile:
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json .
RUN yarn install
COPY . .
RUN yarn run build

FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/build build/
COPY --from=builder /app/node_modules node_modules/
COPY package.json .
EXPOSE 3000
ENV NODE_ENV=production
CMD ["node", "build"]
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json .
RUN yarn install
COPY . .
RUN yarn run build

FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/build build/
COPY --from=builder /app/node_modules node_modules/
COPY package.json .
EXPOSE 3000
ENV NODE_ENV=production
CMD ["node", "build"]
3 replies
DTDrizzle Team
Created by x03 on 4/13/2024 in #help
Need help with a migration
No description
2 replies
CDCloudflare Developers
Created by x03 on 3/25/2024 in #general-help
Need help with redirecting a subdomain to another domain.
No description
68 replies
CDCloudflare Developers
Created by x03 on 3/20/2024 in #general-help
Are there any postgres migration libs that work on pages?
No description
10 replies
DTDrizzle Team
Created by x03 on 3/19/2024 in #help
How do I apply migrations on cloudflare workers?
No description
23 replies
CDCloudflare Developers
Created by x03 on 3/17/2024 in #pages-help
Does node-postgres work on pages?
No description
2 replies
CDCloudflare Developers
Created by x03 on 3/16/2024 in #pages-help
Error: Dynamic require of \"node:buffer\" is not supported
I added amazon SES to my SvelteKit pages application and it deploys perfectly fine, but when visiting the deployment URL it throws a 500 internal error. The logs return this message: Error: Dynamic require of \"node:buffer\" is not supported I have the nodejs_compat flag already added
2 replies
CDCloudflare Developers
Created by x03 on 3/16/2024 in #general-help
Any way to view pages logs?
No description
27 replies
DTDrizzle Team
Created by x03 on 3/13/2024 in #help
Need syntax help
I've been trying out drizzle for a couple hours, and was wondering if there's any way to replicate this action from prisma:
const session = await prisma.session.create({
data: {
userAgent: event.request.headers.get("user-agent"),
user: {
connectOrCreate: {
where: {
email: form.data.email,
},
create: {
email: form.data.email,
},
},
},
},
select: {
id: true,
},
})
const session = await prisma.session.create({
data: {
userAgent: event.request.headers.get("user-agent"),
user: {
connectOrCreate: {
where: {
email: form.data.email,
},
create: {
email: form.data.email,
},
},
},
},
select: {
id: true,
},
})
Is there an equivalent to this way of creating a session that's just as efficient? The main appeal is the "connectOrCreate" functionality.
7 replies
CDCloudflare Developers
Created by x03 on 3/13/2024 in #general-help
Need some hosting advice
I'm working on a project which has it's front-end and backend hosted on CF Pages / Workers, and I also use the CF KV out of convenience. Sadly I can't use D1 for my project, so I'm forced to host some external postgres DB on a VPS and communicate to it from workers. What would be the most secure and reliable way to communicate between my CF Workers and my postgres DB? Using a simple username + password connection string seems simple, but that opens possibility for brute-force attacks. And I'm not sure what types of firewall rule's I'd need to apply because CloudFlare would probably request the database from several different IP addresses.
6 replies
CDCloudflare Developers
Created by x03 on 3/10/2024 in #general-help
Need project hosting advice
I'm working on a startup project which is essentially just a SvelteKit web application with a public API. It uses Redis and PostgreSQL databases. I have two primary hosting options: - Host everything on a VPS manually - Spread hosting out between tools like CF pages, CF workers, CF D1 storage, CF KV, and more. I need advice on which option YOU would choose in my situation with scaling in mind. My thought process is this: Using Cloudflare's tools I'd pay significantly more, but it would be more reliable, (probably) faster, easier to scale, and be more secure. Hosting on a VPS would be WAY cheaper, but scaling would be complicated, downtime would be a possibility, and I'd be responsible for managing and updating VPS tools. I can afford to spend a couple days setting up a VPS, so set-up time isn't much of a concern. My main concerns are scalability, reliability and price. My project will have no cap to user count, and since it has a free public API I expect a lot of incoming requests. I also expect a lot of database reads / writes. All advice is appreciated, I'm just starting on this project so I can afford to switch stacks easily.
17 replies