edmundhung/remix-cloudflare-template

Direct routes accessing

sinitsa opened this issue · 3 comments

Hello, it’s me again ;)

I’m writing some sort of simple marketplace using chakra-ui template, can you take a brief look …

https://ccremix.bzz.workers.dev/dash

This is simple index page without any design and actions, you can access it via link above …

first link - goes to “/“, where in in action: redirect(/list);
second link - just to “/list”

if you go to “/“ or “/list” via links - everything ok. but if you try to just reload this links or another direct access to any link with layout and with or without actions (no matter) - you got Unexpected Server Error
First what I see at console :

GET /list 500 Internal Server Error

…..

TypeError: Cannot read properties of null (reading 'registered')
at /Users/havok/Work/lawsvc/packages/ccremix/dist/worker.mjs:331:15250
at Object.render (/Users/havok/Work/lawsvc/packages/ccremix/dist/worker.mjs:53:94418)
at e.t.render (/Users/havok/Work/lawsvc/packages/ccremix/dist/worker.mjs:1:23821)
at e.t.read (/Users/havok/Work/lawsvc/packages/ccremix/dist/worker.mjs:1:22729)
at Object.l8.renderToString (/Users/havok/Work/lawsvc/packages/ccremix/dist/worker.mjs:3:573)

Do you have any ideas? I can show code, but nothing special there, just design and some fetches to API ….

Sorry for bother you again, and thanks in advance)

When you goes to /list from /, the transition happens on client side only (unless you disabled JS on the browser), while if you access /list directly, it involves SSR. What you describled could be because of some of your code / dependencies on /list works on browser only but not on the server.

I think that this error because of emotion package, as an part of chakra-ui... didn't find cure yet, only hacks that partially works.. will try to use another template, maybe with tailwind... so sad about chakra-ui and cloudflare workers...

@sinitsa That's a pity. But I agree this is the pain point with the Cloudflare runtime at the moment. Most of the libraries out there are still focusing on node & the browser environment. Hopefully the support of other js runtime, like CF, would be getting better soon.