Deploying changes to SolidStart app then navigating the application throws strange error

Before I file this as an official issue or start nagging the rest of the team I want to make sure I'm not deploying or thinking about the issue incorrectly. Basically I'm deploying a SolidStart app on Cloudflare Workers, loading it on my browser, pushing a deploy and noticing that when I navigate between pages an error is thrown. I could be wrong but it seems to happen mostly with Outlets. When I navigate to a page with one, the application loads the nested chunked script that was compiled newly while the one currently cached in browser is older. Hence the child trips up and throws an error because the function it depends on no longer exists. So I see a lot of red errors as a result. How should I be deploying this to ensure that the function names between versions remain consistent and my deployments don't break? or is this a bug with Start's default config.
50 Replies
lxsmnsyc
lxsmnsyc2y ago
how dare that error use the wrong pronouns! /s seems like that error is tied to some use of for (..of He(...))
davedbase
davedbase2y ago
I think the solution here is to ensure that the parent and children of an Outlet are packaged together...?
lxsmnsyc
lxsmnsyc2y ago
Do you mind if I try to RE the output files? I'm seeing [$,_]=He(!0) near const{clearSession:D,breakpoints:Q} weird He turns out to be createSignal
davedbase
davedbase2y ago
Ok maybe it's not related to the outlets :p clearSession, breakpoints are pulling from a site-wide context Perhaps the new chunk that's being pulled is out of sync with the context value? or am I just totally not comprehending the issue lol
lxsmnsyc
lxsmnsyc2y ago
issue is confusing. It says that createSignal is neither a function nor the value it returns is iterable, which is weird
davedbase
davedbase2y ago
Is it because the variable that it’s expecting to pull from context is changing? Like the incoming chunk has a new variable name? I’m assuming the terser uses different identifier on every rebuild
lxsmnsyc
lxsmnsyc2y ago
it does, but the variable itself is consistently mapped, which is why it is weird
davedbase
davedbase2y ago
I can recreate it consistently. Whenever I rebuild it throws the error until I hard refresh.
lxsmnsyc
lxsmnsyc2y ago
Interesting...
davedbase
davedbase2y ago
I really need to resolve this tmrw. Any ideas, send them my way. I'm blocked from updating a project without solve it lol
lxsmnsyc
lxsmnsyc2y ago
Maybe the main guy @nksaraf side mention: @ryansolid
nksaraf
nksaraf2y ago
we cant do much if files from across versions of the app are coexisting I thought the hashing in the filenames would assure that there's no conflict when the new version is asked for.. it should never be cached the first time
davedbase
davedbase2y ago
Was a bit confused by this line. Wondering what a safe solution might be and didn’t consider changing the cache Re-reading it, are you suggesting that all the hashed assets be maintained in the dist folder? Cloudflare Worker has a habit of purging everything not in dist so when I build the old hashed assets are removed....
nksaraf
nksaraf2y ago
normally old hashed assets shouldnt be fetched I wanted to add a feaeture for this inbuilt so if the user is on a page and you deploy a new version, it should cause some kind of reload and maybe the client should handle not finding an asset and cause a reload for that
davedbase
davedbase2y ago
Ah, ok that makes sense. I suppose the question is how can I implement this right now? Sounds similar to Service Worker reload strategy
nksaraf
nksaraf2y ago
Yeah I havent implemented this before .. just had an idea
davedbase
davedbase2y ago
I need to figure out a stopgap solution for the time being
nksaraf
nksaraf2y ago
I think the issue im seeing is that the .js file names dont have hashes in them I would have assumed all the client side javascript would be with hashed filenames even entry-client and stuff
davedbase
davedbase2y ago
I had the hashes in them at one point, had the same issue As I'm understanding the issue, I think I need to deploy with the hashes but ensure that they remain in the Cloudflare Worker instead of purging the entire codebase on build Basically accumulate the build dir not override it so that it maintains the old hash locations
nksaraf
nksaraf2y ago
hmm im so confused lol.. how do people not face this all the time?
davedbase
davedbase2y ago
I'm so confused too tbh
nksaraf
nksaraf2y ago
dont all services make older assets unavailable
davedbase
davedbase2y ago
Major cloudflare pages does this automagically? I using a raw worker
nksaraf
nksaraf2y ago
a newer page shouldnt ask for an older page Im goes
davedbase
davedbase2y ago
true maybe I introduced a new issue when I removed the hashes. let me try with it and I need the build dir to keep all the hashed scripts in cache need to solve that too
nksaraf
nksaraf2y ago
I mean but nobody does this.. how has this stuff been working forever
davedbase
davedbase2y ago
Good question.
davedbase
davedbase2y ago
Yeah I found some details about it. This is a typical ChunkLoadError and it's related to not keeping the cached scripts of old builds. People report it in issues like: https://github.com/cloudflare/wrangler-legacy/issues/1553
GitHub
Option to continue serving old resources · Issue #1553 · cloudflare...
Currently, it seems like when you deploy a Worker Site, if users are still on the 'previous version' and they request a resource they may not get it. For example, UserScreen.abcd.js...
davedbase
davedbase2y ago
So I suppose just using Pages is my solution
lxsmnsyc
lxsmnsyc2y ago
@davedbase also I forgot to mention, does this happen on all pages?
davedbase
davedbase2y ago
No just the ones with chunks that are fetched I think Hmmmm Cloudflare Pages seems to be much better when I redeploy... Did hit a minor and SUPER strange issue just now...
davedbase
davedbase2y ago
I can deploy via Pages and it works well: https://romamoulding-com.pages.dev/
RomaMoulding.com
Roma Moulding is a world leader in high-quality Italian-made framing.
davedbase
davedbase2y ago
But when I attach a domain I get a weird error: https://stg.romamoulding.com/
RomaMoulding.com
Roma Moulding is a world leader in high-quality Italian-made framing.
davedbase
davedbase2y ago
It's the same worker...the only thing that's changed is the custom domain is pointing to it via a CNAME Very likely a userland problem but it's plaguing me. lol. I'll conclude the issue because this seems the right path
Razboy20
Razboy202y ago
(Not particularly related to this problem, but just wanted to point out that clicking on the "favorite" icon under products shows an error if you haven't selected any products before)
nksaraf
nksaraf2y ago
seems to be working right now
davedbase
davedbase2y ago
Yeah there’s a plethora of minor bugs. The site was coded in a rush so we’re just slowly cleaning and optimizing it. It's not working 100%. There seems to be a hydration issue on the page on the stg subdomain which isn't happening on the pages.dev link
nksaraf
nksaraf2y ago
ohh didnt notice lol
davedbase
davedbase2y ago
Ugh it's so annoying. Why the hell is there a difference between the custom domain and not? cries lol
nksaraf
nksaraf2y ago
this errors always like fucking kill me right now
lxsmnsyc
lxsmnsyc2y ago
Nikhil lost it 🤣
davedbase
davedbase2y ago
I feel your pain. I'm going to dive into it tmrw. Trying my best to stay offline today for ma bday
lxsmnsyc
lxsmnsyc2y ago
didn't know you and Ryan share birthdays
davedbase
davedbase2y ago
1 day apart actually lol Tanner, Ryan and the real talent share the same day haha
lxsmnsyc
lxsmnsyc2y ago
the oldies have talents jk
lxsmnsyc
lxsmnsyc2y ago
nksaraf
nksaraf2y ago
Happppyy Birthdayyy man!!
davedbase
davedbase2y ago
Thx you