Unable to deploy Fresh to Cloudflare Workers
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- deno, typescript
Direzione di ricerca
Start with the Cloudflare Workers deployment docs and the reporter's vite.config.ts, main.ts, and wrangler.jsonc configuration. Reproduce the deployment using the linked example repository, then trace why static assets work while page and API routes return “NOT FOUND.” The issue is resolved when those routes work on the deployed Worker.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi, I'm trying to deploy a Fresh project to Cloudflare Workers, but I've been unsuccessful.
Here are the steps I followed:
-
I created a new project using the following command:
deno run -Ar jsr:@fresh/init -
I followed the Cloudflare Workers | Fresh docs and added the required code to
vite.config.tsfile. -
I added a
wrangler.jsoncfile with the following content:{ "$schema": "node_modules/wrangler/config-schema.json", "name": "fresh2-example", "main": "./main.ts", "compatibility_date": "2025-04-01", "compatibility_flags": ["nodejs_compat"], "observability": { "enabled": true }, "upload_source_maps": true } -
I added the following code to the end of my
main.tsfile:export default { fetch: app.handler(), }; -
I pushed the project to a GitHub repository, which you can find here: mzl980425/fresh2-example. Then, I created a new Worker on Cloudflare and connected it to this repository. The worker's build configuration is as follows:
- Build command:
npx deno task build - Deploy command:
npx wrangler deploy
- Build command:
-
After the deployment was complete, I found that static assets are served correctly (e.g.,
https://xxx.workers.dev/favicon.ico,https://xxx.workers.dev/logo.svg). However, all other page and API routes return a "NOT FOUND" error, including the root page (https://xxx.workers.dev/) and API routes like (https://xxx.workers.dev/api2/world).
Is there something wrong with my code or configuration? Any help would be greatly appreciated.
Thanks
- Lingua principale
- TypeScript
- Stelle
- 13.8k
- Fork
- 757
- Merge medio
- 3m
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di freshframework/fresh
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
freshframework/fresh#3920 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
freshframework/fresh#3833 ·
-
feat
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
freshframework/fresh#3803 · 1 commento ·
-
Did you stop maintaining it?Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
freshframework/fresh#3918 · 1 commento · 4 reazioni ·
-
Tab title doesn't update to <Head> <title> when navigating to a page with another <title>Forse già presa @1AbdullahButt l’ha presa 7 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 57/100
freshframework/fresh#3916 ·
Tutte le issue di freshframework/fresh
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
software-mansion/argent#1946 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
podman-desktop/podman-desktop#20216 ·
I maintainer di solito rispondono entro 1 giorno
-
[Type] Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
WordPress/ai#1386 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
omdsh-dev/DSH-better-sidebar#1205 ·
I maintainer di solito rispondono entro 3 giorni