jman
jman
Explore posts from servers
CDCloudflare Developers
Created by jman on 1/16/2025 in #workers-help
sql.prepare is not a function in Durable Objects SQL
In Durable Objects SQL - I'm trying to test preparing statements, and I'm seeing that prepare is not a function . Is sql.prepare not available in Durable Objects SQL storage?
4 replies
CDCloudflare Developers
Created by jman on 12/29/2024 in #workers-help
Vitest `Failed to pop isolated storage stack frame` when error thrown
With a durable object as simple as:
export class FeedStorage extends DurableObject {
async test() { throw new Error("My impl is broken") }
}
export class FeedStorage extends DurableObject {
async test() { throw new Error("My impl is broken") }
}
And running tests through the vitest integration:
it('fetches feed', async () => {
const stub = env.FEED_STORAGE.get(env.FEED_STORAGE.idFromName('main'))
const res = await expect(() => stub.test()).rejects.toThrowError()
})
it('fetches feed', async () => {
const stub = env.FEED_STORAGE.get(env.FEED_STORAGE.idFromName('main'))
const res = await expect(() => stub.test()).rejects.toThrowError()
})
I end up with Vitest caught 1 unhandled error during the test run., and Failed to pop isolated storage stack frame I'd expect this to be propagated up through rpc as it is mentioned in the docs here so vitest can handle it. What is the suggested way to handle thrown errors in implementation in tests?
8 replies
CDCloudflare Developers
Created by jman on 12/15/2024 in #workers-help
RPC of a Service Binding / DO: Adding middleware?
I don't see any references in the docs so I assume the answer is no, but I'm wondering if it's possible to add middleware in any way to Durable Object RPC classes or Service Bindings? I could envision a potential userland solution, but I'm curious if there is something that already exists?
1 replies
CDCloudflare Developers
Created by jman on 4/7/2024 in #pages-help
Specifying a `-- <command>` or `--proxy` is deprecated and will be removed
Recently noticed this warning when running wrangler pages dev -- vite:
[WARNING] Specifying a `-- <command>` or `--proxy` is deprecated and will be removed in a future version of Wrangler.

Build your application to a directory and run the `wrangler pages dev <directory>` instead.
This results in a more faithful emulation of production behavior.
[WARNING] Specifying a `-- <command>` or `--proxy` is deprecated and will be removed in a future version of Wrangler.

Build your application to a directory and run the `wrangler pages dev <directory>` instead.
This results in a more faithful emulation of production behavior.
I'm curious what the suggestion is for users of vite or similar framework where there is no directory in dev mode?
3 replies
CDCloudflare Developers
Created by jman on 3/15/2024 in #pages-help
Point to remote r2 bucket when running pages dev locally?
Is there any way to point a binding to a remote r2 bucket when running pages dev locally? From the docs on the --r2=BINDING_NAME flag, it seems to only support a local bucket?
2 replies
CDCloudflare Developers
Created by jman on 3/5/2024 in #pages-help
Preview branch, custom domain not supported
When adding a custom domain for a preview branch using external DNS, this page states that custom domains are not supported for external DNS. https://developers.cloudflare.com/pages/how-to/custom-branch-aliases/ Why does this limitation exist? Are there any ways to work around this functionality?
9 replies
TtRPC
Created by jman on 2/29/2024 in #❓-help
Is there any way to temporarily disable mutations?
My goal is to move into a read-only mode temporarily. I'm thinking anything could be fine as a short term solution. 1. Throw an explicit error when mutations try to be called 2. Procedure not found error 3. Stop support POST requests?
2 replies
CDCloudflare Developers
Created by jman on 12/28/2023 in #pages-help
Ignore paths in pages `functions` directory
Are there any prefixes that will allow me to ignore files in the functions directory, so I can locate my non-route logic adjacent to my routes? Other frameworks often use an underscore prefix for instance If not, is there a way to specify multiple directories for wrangler to watch during wrangler pages dev? Putting my server code in ./server doesn't trigger auto-refreshes...
1 replies
CDCloudflare Developers
Created by jman on 7/30/2023 in #workers-help
See logs when using unstable_dev?
When using unstable_dev, I can't seem to find any docs on how to see / inspect logs or errors coming from the worker or durable objects. How can I see the logs?
3 replies
CDCloudflare Developers
Created by jman on 6/30/2023 in #workers-help
Determine if built by wrangler dev or wrangler deploy
I have a worker which when running locally will proxy to a Vite server, but when deployed will be a Workers Site using kvAssetHandler. Is there any default way to determine which it was built for? Or do I need to mess with .dev.vars?
1 replies