veeque
veeque
Explore posts from servers
DTDrizzle Team
Created by veeque on 5/11/2025 in #help
Migrate only up to a certain migration
Due to the system I'm running I need to run a migration up to a certain point, then run some logic, and only then keep with the normal migrations. This is because the logic I need to mutates data in a certain way. Is there a way to tell this to migrate()?
8 replies
HHono
Created by veeque on 5/10/2025 in #help
Maintaining slugs when grouping
If I group my API into two apps, and then mount one of the groups into a path that contains a slug, how can I use that slug in the app? For example, here, how would I use thisSlugHere in booksApp?
import { Hono } from 'hono'
import { hc } from 'hono/client'

const authorsApp = new Hono()
.get('/', (c) => c.json({ result: 'list authors' }))
.post('/', (c) => c.json({ result: 'create an author' }, 201))
.get('/:id', (c) => c.json({ result: get ${c.req.param('id')} }))

const booksApp = new Hono()
.get('/', (c) => c.json({ result: 'list books' }))
.post('/', (c) => c.json({ result: 'create a book' }, 201))
.get('/:id', (c) => c.json({ result: get ${c.req.param('id')} }))

const app = new Hono()
.route('/authors', authorsApp)
.route('/books/{thisSlugHere}', booksApp)

type AppType = typeof app
import { Hono } from 'hono'
import { hc } from 'hono/client'

const authorsApp = new Hono()
.get('/', (c) => c.json({ result: 'list authors' }))
.post('/', (c) => c.json({ result: 'create an author' }, 201))
.get('/:id', (c) => c.json({ result: get ${c.req.param('id')} }))

const booksApp = new Hono()
.get('/', (c) => c.json({ result: 'list books' }))
.post('/', (c) => c.json({ result: 'create a book' }, 201))
.get('/:id', (c) => c.json({ result: get ${c.req.param('id')} }))

const app = new Hono()
.route('/authors', authorsApp)
.route('/books/{thisSlugHere}', booksApp)

type AppType = typeof app
6 replies
CDCloudflare Developers
Created by veeque on 5/6/2025 in #workers-help
How to redefine types generated by `wrangler types`
Running wrangler dev generates
declare namespace Cloudflare {
interface Env {
IDENTIFIER_RESOLVER: DurableObjectNamespace<import("./src/index").IdentifierResolver>;
USER: DurableObjectNamespace<import("./src/index").User>;
ARGON2: Fetcher;
}
}
interface Env extends Cloudflare.Env {}
declare module "*.sql" {
const value: string;
export default value;
}
declare namespace Cloudflare {
interface Env {
IDENTIFIER_RESOLVER: DurableObjectNamespace<import("./src/index").IdentifierResolver>;
USER: DurableObjectNamespace<import("./src/index").User>;
ARGON2: Fetcher;
}
}
interface Env extends Cloudflare.Env {}
declare module "*.sql" {
const value: string;
export default value;
}
but I want ARGON2 to be something else. I would like to add a app.d.ts file in my src/ folder such that I define it to be a worker with RPC methods (it doesn't automatically because it's a rust-based worker).
3 replies
CDCloudflare Developers
Created by veeque on 4/23/2025 in #workers-help
How to define RPC methods on a separate file
I have an RPC method that is very long and thus don't want to define in the same place as other functions. I though about doing myFunction = myFunction but it complains that The RPC receiver does not implement the method "myFunction". Since myFunction uses this it's defined as:
export async function myFunction(
this: AuthWorker,
otherArg: SomeOtherType,
) {}
export async function myFunction(
this: AuthWorker,
otherArg: SomeOtherType,
) {}
I even tried "proxying" it
import { myFunction } from './some/other/path'
async myFunction(...args: Parameters<typeof myFunction>) {
return await myFunction(this, ...args);
}
import { myFunction } from './some/other/path'
async myFunction(...args: Parameters<typeof myFunction>) {
return await myFunction(this, ...args);
}
but now it complains that it expected 1 arg, but got two
2 replies
DTDrizzle Team
Created by veeque on 4/19/2025 in #help
How to handle multiple Durable Objects (with different schemas and migrations)
Is there a way to kind of have two Drizzle "projects" in one? I want to have two sets of schemas, and two of everything such that I can all one set of migrations on one Durable Object, and another on another Durable Object. This is because one worker allows for multiple Durable Objects to be defined and used
1 replies
CDCloudflare Developers
Created by veeque on 4/16/2025 in #workers-help
ETA for being able to set watch paths in `wrangler.jsonc`?
To configure watch paths for Workers Builds (https://developers.cloudflare.com/workers/ci-cd/builds/build-watch-paths/) I have to use the dashboard. The config for it (https://developers.cloudflare.com/workers/wrangler/custom-builds/) is currently not honored (https://developers.cloudflare.com/workers/ci-cd/builds/configuration/). Is there an ETA for when that config option is going to be honored?
1 replies
CDCloudflare Developers
Created by veeque on 4/15/2025 in #workers-help
`wrangler types` uses generic type for `DurableObjectNamespace`
I have a Worker with the default being the extended WorkerEntrypoint and a DurableObject DO. runnign wrangler types gives:
declare namespace Cloudflare {
interface Env {
MY_DURABLE_OBJECT: DurableObjectNamespace /* MyDurableObject */;
}
}
declare namespace Cloudflare {
interface Env {
MY_DURABLE_OBJECT: DurableObjectNamespace /* MyDurableObject */;
}
}
So clearly it knows even the name of the DO, just refuses to put it as DurableObjectNamespace<MyDurableObject>
10 replies
CDCloudflare Developers
Created by veeque on 4/15/2025 in #workers-help
Know commit hash of running worker
When the worker is deployed I would like to have a way for the worker to know what is the commit version that was used to build/ship it. Kind of like having an env var that stores the output of git rev-parse HEAD that i can just reference in the worker's code itself.
4 replies
CDCloudflare Developers
Created by veeque on 4/14/2025 in #pages-help
How do I reinstall the git integration?
No description
2 replies
CDCloudflare Developers
Created by veeque on 3/31/2025 in #workers-help
Environments best practices
With workers I can have a "default" environment (placing things in the root of the wrangler.jsonc, and n environments such as development. What's better: having the "default" be the production one with the development one being specified as a separate env (requiring me to add -e development when using that), or having the "default" one be the development, with the prod being its own env?
3 replies
CDCloudflare Developers
Created by veeque on 3/28/2025 in #workers-help
Preview deployments non a thing with Assets?
With Pages I could just push to another branch and that got its own .pages.dev URL. Doing the same with Workers Assets doesn't give me such URL, so... how can I get a preview deployment?—say that of the dev branch
8 replies
CDCloudflare Developers
Created by veeque on 3/27/2025 in #workers-help
Build rust workers
Using the git integration it complains that cargo is not found. Is this a limitation of the git integration?
3 replies
CDCloudflare Developers
Created by veeque on 3/26/2025 in #workers-help
Cannot deploy Worker Assets
No description
18 replies
CDCloudflare Developers
Created by veeque on 3/25/2025 in #pages-help
In SvelteKit do I have to use `wrangler dev` instead of `vite dev` to make service bindings work?
I have two SvelteKit projects, both running on Pages. Project B has a service binding to Project A but it only works if Project A is running the preview script (which contains wrangler dev), and not when using the dev script (vite dev). Is this a "hard" limit or is there a way to make service bindings work with the "normal" dev mode?
4 replies
CDCloudflare Developers
Created by veeque on 3/20/2025 in #pages-help
Image transform with SvelteKit
So, I put the images in the assets folder, but how do I use cloudflare's image transformation now? Say i have pic.jpg in assets/pic.jpg, visible on https://my-page.pages.dev/pic.jpg. doing https://my-page.pages.dev/cdn-cgi/image/width=80,quality=75/pic.jpg doesn't return anything... how is this supposed to work?
1 replies
CDCloudflare Developers
Created by veeque on 3/20/2025 in #pages-help
Is there a build time limit?
i got this after 3 mins (builds locally)
20:11:54.983  ELIFECYCLE  Command failed with exit code 139.
20:11:55.006 Failed: Error while executing user command. Exited with error code: 139
20:11:55.016 Failed: build command exited with code: 1
20:11:56.157 Failed: error occurred while running build command
20:11:54.983  ELIFECYCLE  Command failed with exit code 139.
20:11:55.006 Failed: Error while executing user command. Exited with error code: 139
20:11:55.016 Failed: build command exited with code: 1
20:11:56.157 Failed: error occurred while running build command
14 replies
CDCloudflare Developers
Created by veeque on 2/3/2025 in #general-help
How do image transformations work? (SvelteKit + unpic)
I have a SvelteKit app, and place the images inside the assets folder. Then, using unpic, it should (but doesn't) fetch from some cf-specific url to transform the images. This doesn't happen and I have no idea how to actually make it work.
1 replies
CDCloudflare Developers
Created by veeque on 1/29/2025 in #pages-help
What's the difference between Cloudflare Pages and Workers Frameworks?
Basically, when making an app, which should I choose and why? The line between them is really blurry.
14 replies
HHono
Created by veeque on 1/27/2025 in #help
What is the difference between `Zod OpenAPI` and `Hono OpenAPI`?
From reading the docs I can't tell why I should use one as opposed to the other. Can I use both? If so, how?
15 replies
DTDrizzle Team
Created by veeque on 1/21/2025 in #help
What is the recommended way to have a staging and a production environment?
For the record, I'm using Cloudflare D1. I know how to set up the wrangler.json file such that based on the environment I use a different database (same binding, just different database IDs). How can I make it so the drizzle.config.ts file uses a different .env file based on the environment being used?
4 replies