Dev server instability / client-side CORS error during development
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- deno, typescript
- Domain
- devtools
Research direction
Start by tracing how the Fresh dev server emits island import paths and compare the normal and broken HTML snippets in the issue. The payload does not name relevant source files or tests, so first locate the dev server code that generates these imports and look for a way to reproduce the intermittent failure. Done means island imports keep their expected /@id/ paths and hot reload continues working after iterative development.
Written by the indexing model from the issue text.
Description
I've recently begun using Fresh for the first time, and I've been struggling a bit with the dev server stability.
After a bit of iterative work on my Fresh app, the islands suddenly break and hot reload stops working. The dev server keeps serving the latest content when I reload. Regardless, if I'm working on an island then this is a show stopper until I go back to the terminal and kill+restart deno run dev. Once I do that, everything works again for another while.
Page Error
The browser console error resembles this:
❌ Access to script at 'fresh-island::EmptyIsland.tsx' from origin 'https://[...]' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: chrome, chrome-extension, chrome-untrusted, data, http, https, isolated-app.
❌ fresh-island::EmptyIsland.tsx:1 GET fresh-island::EmptyIsland.tsx net::ERR_FAILED
Difference in emitted HTML
I've noticed that the script content in the served HTML changes when the issue occurs, normally it looks like this: (line breaks added for readability)
<script type="module" nonce="ea0a857d6094481086103eb6593c3faf">
import { boot } from "/@id/fresh:client-entry";
import EmptyIsland from "/@id/fresh-island::EmptyIsland";
boot({EmptyIsland},"[[1],{\"slots\":2,\"props\":3},[],{}]");
</script>
When the client is broken, the served HTML instead looks like this:
<script type="module" nonce="12f27aae0dad496baf9394f2d2defdb5">
import { boot } from "/@id/fresh:client-entry";
import EmptyIsland_2 from "fresh-island::EmptyIsland.tsx";
boot({EmptyIsland_2},"[[1],{\"slots\":2,\"props\":3},[],{}]");
</script>
It seems like something on the dev server is losing some context about how it should emit import paths.
(I see that the symbol name changed to include _2 in the sample, I don't know if that's always the case or for some other reason)
Previous context
I've found a previous issue which seems to have a similar symptom but a different cause, as it describes a Fresh upgrade which resulted in an app which doesn't work at all:
- 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