Cannot read properties of undefined (reading 'result')
I kept getting this random error on my loader function so I changed it to a before load and I keep getting the exact same error. Its so weird because I can't even catch the bloody error. If I place a try catch over my entire fn it still throws.
This is the entire error:
I have identified that the error occurs after I try to update some stuff on a google sheet. But its weird because the update goes through perfectly
8 Replies
flat-fuchsia•6mo ago
please share your code
fascinating-indigoOP•6mo ago
@Manuel Schiller here, it got more complicated than needed bc I keep trying to catch the error 😦
flat-fuchsia•6mo ago
I don't see any server functions being defined
fascinating-indigoOP•6mo ago
No server function is defined anywhere
I call two functions that are in external files
Aaah, that might be the issue right?
beforeLoad might run on the client
which means I should wrap all this logic in a server fn
flat-fuchsia•6mo ago
the error states that there are server functions involved
fascinating-indigoOP•6mo ago
I guess it is refering to updateCustomersList & sendPreinscriptionEmail. They arent defined as server functions but I think I have fileName.server.ts
Sheets is literally this:
Okay literally what I said. Weird but ok. It works if I wrap everything in a serverfn. Can you confirm that beforeLoad can run on the client?
flat-fuchsia•6mo ago
yes sure it runs on the client
as well as loader
initial SSR runs all on the server
subsequent client navigations everything runs on the client
fascinating-indigoOP•6mo ago
Alright. perfect. Yea my bad on the mental model. thanks!