Solid Start error
https://damon.systems/projects
When loading the page it gets loaded I ge tthis error saying l is null and it looks unrelated to my component, and it works locally I dont really know where to go from here. Here is the component:
https://github.com/day-mon/damon.systems/blob/main/src/routes/projects.tsx
damon
damon is a software engineer based in the u.s.a.
GitHub
damon.systems/src/routes/projects.tsx at main · day-mon/damon.systems
personal website made in svelte. Contribute to day-mon/damon.systems development by creating an account on GitHub.
80 Replies
Hi, it might be worth using a resource rather than signals for fetching your data, as it has built in error handling functionality as well as a loading state signal
You're probably hitting a different branch in production, and accessing a property on something that is undefined
the weird thing is I ran the docker file i use when deployed
and it works fine
its only when deployed on my vps i ge these weird errors
Difference in session storage?
Seeing as you try to fetch from there first
Maybe try logging which if branches you reach and see if there's a difference between local deployment and vps deployment?
I can add in a version number but it builds the docker file on the main branch and i build and run the docker ifle off the main branch so im just confused
I mean code branches, like blocks within if/else statements
aah
Sorry for being unclear lol
So your suggestion is to not use signals?
to store the projects?
Resources wrap signals
And make async data fetching and error handling easier
https://docs.solidjs.com/references/api-reference/basic-reactivity/createResource
So you can check if the resource has errored or loaded
And access the data by calling the accessor returned
okay ill give it a try
You can then wrap in suspense so the component waits until the data has finished loading before it shows
Yeah thanks i guess i gotta read the docs more I have no clue what any of that is
thank you for letting me know
The type signatures are super hard to read
This section is probably what you want
i updated it
and still nothing 😦
this is also very slow but idk if i am using it right
Ooh it's a nextSibling error, I'll clone the repo later and see if I can debug it
thanks tommy 🙂
I've just cloned and can't reproduce your error (I don't use docker), but octokit seems to be trying to import os, which vite is externalizing, and I wonder if this could somehow be causing issues
Maybe try removing octokit if you can and see if your page works?
but why does it work locally?
Possibly os works during SSR when you're running it locally, but not on the VPS?
Could be permissions stuff
I'm not sure how everything is configured
But octokit is your only dependency on that component that you don't have anywhere else
okay thanks, tommy ill look into another solution
how did you figure that out btw
vite logged a message in the console saying os was externalised lol
i got no clue what that even means haha
Basically
os
doesn't exist on the client so vite removes it for you in that runtime
but it should exist in node so it'll try to run
Did removing octokit work for you then?trying it now
https://docs.github.com/en/free-pro-team@latest/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-a-user
gh expects you to use octokit
GitHub Docs
Repositories - GitHub Docs
but im changin git ot fetch
didnt fix 😦
removed octokit completely
GitHub
damon.systems/src/routes/projects.tsx at main · day-mon/damon.systems
Contribute to day-mon/damon.systems development by creating an account on GitHub.
Huh
That's really weird
And all your other components work?
yep
its so weird its only on the vps
http://upload.montague.im/u/nitOKm.png
no errors either (ss)
I'm honestly not sure what the problem could be then
A weird hydration issue but only on that VPS
is the way i am doing this component like weird in anyway?
You should probably be using
Suspense
like it doesnt even make the web request but it knows its loading
Suspense should make the resource resolve on the server
https://docs.solidjs.com/references/api-reference/control-flow/Suspense
So you should be able to remove your
<Show when={data.loading}>
and put that in the fallback
And just move the stuff within <Show when={data()}>
inside the suspenseim guess im just confused on how it works
how does it now when to show the correct code
because i want it to display when there is no error and its not loading wouldnt i need a show?
Resources hook into suspense
and suspense will automatically find all the resources you use and will wait for them
You can probably also remove your
<Show when={data.error}>
, and replace it with an ErrorBoundary https://docs.solidjs.com/references/api-reference/control-flow/ErrorBoundaryso something liek this
Yep that should be good
Does it work locally?
yep
i just deployed
i really appreciate all of this by the way, i didnt expect someone to go out of their way to do this
Dw :) I haven't rlly solved anything yet haha
Your time was still spent thats what makes teh difference
ah
it works
but
i still get the erros in console lol
Better than nothing lol
yeah im fine with that i really apperciate that
Can you go into devtools and see where they're happening?
i actually learned alot
awesome
you want the stack trace or
yeah, sure
Does this go away if you remove the
For
component
nextSibling stuff is sometimes because of for stuff being strangeshould I replace it with a map?
like data().map
I'd remove it entirely for now
Just to check if it's the source of the problem
nope
Formoved hte for
This is honestly so strange, where it works in dev and prod, just not on the VPS
What VPS are you using?
Sorry about being unable to help much, as everything works locally I can't really test and work on anything myself lol
you fixed my problems tommy
i really appreciate it
contabo vps running arch
Another error I ran into
https://dev.damon.systems/
literally on the hompage... idk if im just posionous to the library
I presume this is only on your VPS?
yep lol
It might just be worth using a different hosting provider then lol
If that's possible for you
im just confused if its running in docker how this could be the issue
Im nto saying its not i dont know how that came off
just trying to figure out
Yeah I'm honestly not sure
All your code looks good to me
So possibly it's
universal-cookie
or something
Especially since it was last updated 3 yrs agookay, ill try to remove that doesnt solid have built in cookie stuff?
it's unlikely
yeah it does
https://github.com/Tommypop2/PricelessResults/blame/main/frontend/src/context/ThemeProvider.tsx#:~:text=26-,const,%3B,-4%20months%20ago
This is some code I've got for handling theming isomorphically
I did also write a solid-primitives package for it, but bundling causes issues with it
so i can c + p this context
and add it to my root component
and it should theoritically work]
Just the code I highlighted
and the signal just below it
sorry for the git blame view lol, copying like to highlights doesn't work from the code view
yeah so ihave been having trouble with this so is the issue with dark mode with ssr the server has one value and the client has another?
yeah
causes hydration errors
which can be the source of nextSibling problems I think
You'll also want an effect for updating the theme cookie when the user toggles the theme
I have a slightly different function because I'm syncing the theme between tabs
do I need to use a provider or can i put this in a root component?
You can just put it in the root
But you'll want a provider if you're planning on accessing the theme anywhere else down the tree
GitHub
damon.systems/src/root.tsx at dev · day-mon/damon.systems
Contribute to day-mon/damon.systems development by creating an account on GitHub.
well it works locally perfectly
not deployed
Huh
At least we've removed some unnecessary dependencies lol
is tehre anyway i can do some debugging on the deployed verison?
it was something in this component that was causing the bug
Hmm, I'll take another look later. I'd be careful using
map
because that'll recreate all the DOM nodes every time the value changes, instead you should probably use <For></For>