lecstor
lecstor
CDCloudflare Developers
Created by makisuo on 4/5/2025 in #workers-help
Workers Vite in browser not trying to reach worker
I found it is possible to hack a fix into @Cloudflare/vite-plugin.. https://github.com/lecstor/workers-sdk/pull/1 yarn patch @cloudflare/vite-plugin @cloudflare/vite-plugin/dist/asset-workers/asset-worker.js
var ar = async (t14, e, n, r) => {
return (
(tr(n, Kt) &&
t14.headers.get("Sec-Fetch-Mode") === "navigate"
&& !new URL(t14.url).pathname.startsWith("/auth/")) // <----- hackedy hack
|| (n = { ...n, not_found_handling: "none" }),
!((await ir(t14, e, n, r)) instanceof ye)
);
};
var ar = async (t14, e, n, r) => {
return (
(tr(n, Kt) &&
t14.headers.get("Sec-Fetch-Mode") === "navigate"
&& !new URL(t14.url).pathname.startsWith("/auth/")) // <----- hackedy hack
|| (n = { ...n, not_found_handling: "none" }),
!((await ir(t14, e, n, r)) instanceof ye)
);
};
5 replies
CDCloudflare Developers
Created by makisuo on 4/5/2025 in #workers-help
Workers Vite in browser not trying to reach worker
hmm.. https://github.com/cloudflare/workers-sdk/issues/8430#issuecomment-2798510465
I discovered the same thing when setting up OAuth (was very unintuitive). Ended up creating a separate worker to handle it.
5 replies
CDCloudflare Developers
Created by makisuo on 4/5/2025 in #workers-help
Workers Vite in browser not trying to reach worker
I have the same issue. I'm using lucia to for social login in a working Pages app I'm trying to convert to workers with the new Vite plugin. For that we need the browser to be able to hit the worker directly for the login/callback paths but instead just get Not Found (on root route) for eg http://localhost:8788/auth/google/log-in It feels like this would require configuring specific routes that should go to the worker. I found a route property in wrangler config but that's not what we need. AI thought routing could go in the Vite plugin config but it seems it was just being delusional again. Definitely seems like it should be a wrangler thing as it's directly related to "not_found_handling".
5 replies