mihaaai
Explore posts from serversIs there a way to get bindings outside the `c` Context of an inbound Request in Cloudflare Workers?
I'm trying to setup the better-auth with D1 but following the guide it pops out that I need to have a valid reference of my binded D1 database outside of the inbount request context (the c.env).
There are other examples of using D1 with better-auth but I can't figure out how to make it work within a Hono app deployed on Cloudflare Workers.
The configuration file is within
/src/lib/auth.ts
but isn't called directly nowhere within the Hono app
I have a worker-configuration.d.ts
in my src
directory declaring the DB as a D1Database type, and the wrangler binding as well.10 replies
How to trigger server function for SSR when transitioning routes?
Is there any way to achieve a new SSR call to the backend for each route I
navigate()
with useNavigate()
within a [slug] pattern?
I have a createAsync()
in [slug].tsx that is supposed to get some data from the backend based on the route I get to, but it triggers only with a full refresh of the tab in the browser or fisrt page load, if I try to navigate()
from inside the app the createAsync()
function is not called anymore, it's a "use server" declared function, with a cache()
wrapper, just like the examples on docs.
Ideally I wouldn't use <A>
components and stick to useNavigate()
but I'm open to anything would make this work.
Maybe this is the correct behavior of my setup but I couldn't find anything related to my use-case in the docs7 replies
CDCloudflare Developers
•Created by mihaaai on 7/16/2024 in #workers-help
Doubt about the Service Binding subrequests billing
Although the ecosystem is growing and I'm really glad about all the additions, I'm having a hard time decrypting the docs across all the services.
I'm confused about the billing of subrequests made in a Service Binding context.
I'm wondering if they still count as against the subrequest of the original request, If I have an API on Worker A and make a request through
RPC
to Worker B will this count as 2 worker requests or just one?
From here I understand that it will increase the counter to 2 https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#limits
But from here https://developers.cloudflare.com/workers/platform/pricing/#workers I see that subrequests are not billed inbound.
I remember a couple of months ago asking a similar questions and got a hint about a Twitter post where the proposal to make Service Binding requests count as only one request being in discussed inside CF, but never got any news ever since. I lost the source of the Tweet.
TLDR: Will making a request from a worker to another worker through Service Bindings increase the worker requests counter to 2 or more or it will be counted only as one request to the first worker called?1 replies
How to use `createResource` value to initialize another signal on the client?
I'm trying to fetch from my API a
json
that contains a link to Spotify preview (an audio) and then feed it to the audio primitive, the problem is that at render time it's undefined until it resolves the request and return the json, so the audio is undefined and I cannot play it.
How to handle such situations with Solid?
Maybe with onMount? Typescript keeps complaining about the song()
being possibly undefined and it's right, but how it's the correct way of using the values returned by createResources in the body of the function before it returns?
For more context I'm using this within Astro in a client:only"solid-js"
which means that the code is not wrapped in <Suspense>
and it's executed only on the client (my API updates the last song played in Spotify each 10 mins so I need the component to also return the last song played at each refresh). If I set another client:
directive it works without any problem but I'll only get the last song played during the last build of the app, insted of it being dynamic.
No SSR is involved, everything is SSG3 replies