Unable to deploy Fresh to Cloudflare Workers
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- deno, typescript
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- TypeScript
- Stars
- 13.8k
- Forks
- 757
- Avg merge
- 3m
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from freshframework/fresh
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
freshframework/fresh#3920 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
freshframework/fresh#3833 ·
-
feat
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
freshframework/fresh#3803 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
freshframework/fresh#3918 · 1 comment · 4 reactions ·
-
Tab title doesn't update to <Head> <title> when navigating to a page with another <title>Possibly taken @1AbdullahButt claimed this 7 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 57/100
freshframework/fresh#3916 ·
All issues in freshframework/fresh
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tintinweb/pi-subagents#459 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
danielmiessler/LifeOS#2830 ·
Maintainers usually reply within 6 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area: client enhancement priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
opensro-dev/opensro#3681 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day