uncreative name
uncreative name
CDCloudflare Developers
Created by uncreative name on 5/5/2025 in #workers-help
Subrequest through service binding sent twice?
i am using RR7 for SSR and trying to fetch the same worker that runs RR7. I have set it up so that all requests go through hono first and if they fall through get handled by the rr7 handler. I made sure the loader only runs once, but the logs seem to indicate that two requests are sent? I added a random UUID to the request and its the same UUID on both requests, but the request ID is different.
export async function loader({ context }: Route.LoaderArgs) {
console.log("Loader running from ", new Error().stack);
const res = await context.cloudflare.env.SELF.fetch(
`https://local.worker/api/test?debug=${crypto.randomUUID()}`
);
const data = (await res.json()) as { message: string };
return {
message: data.message,
};
}
export async function loader({ context }: Route.LoaderArgs) {
console.log("Loader running from ", new Error().stack);
const res = await context.cloudflare.env.SELF.fetch(
`https://local.worker/api/test?debug=${crypto.randomUUID()}`
);
const data = (await res.json()) as { message: string };
return {
message: data.message,
};
}
does anyone have an idea what could be causing this? i genuinely dont know since this right now is the only code path where i call the service binding, and its definitely not running twice
6 replies