DEV Community

Discussion on: Writing a React SSR app in Deno

 
craigmorten profile image
Craig Morten • Edited

Curious...! I'll check out your repo and see what I've missed 😄 Had it working locally when did the rewrite so maybe something lost in translation somewhere! 😅

Update:

So I ran the following:

$ mkdir clytras
$ cd clytras
$ git clone git@github.com:clytras/deno-react-ssr.git

Cloning into 'deno-react-ssr'...
coremote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 9 (delta 1), reused 8 (delta 0), pack-reused 0
Receiving objects: 100% (9/9), done.
Resolving deltas: 100% (1/1), done.

$ cd ./deno-react-ssr
$ deno upgrade

Looking up latest version
Local deno version 1.5.4 is the most recent release

$ deno --version

deno 1.5.4 (bc79d55, release, x86_64-apple-darwin)
v8 8.8.278.2
typescript 4.0.5

$ deno run --allow-net --allow-read --unstable ./server.tsx

Check ~/git/clytras/deno-react-ssr/server.tsx
React SSR App listening on port 3000
Enter fullscreen mode Exit fullscreen mode

Opened up http://localhost:3000 on both Firefox and Chrome (for MacOS) and could see the app running as intended without any console errors!

Firefox:

Deno React SSR application running in Firefox with developer console open and no errors displayed

Chrome:

Deno React SSR application running in Chrome with developer console open and no errors displayed

When you have run your updated application, have you checked to see if the old version of the application has been stopped! I commonly use port 3000 for apps and find all the time that I'm wondering why one app isn't right when I have a forked version running in a different window! (E.g. lsof -ti tcp:3000)

Otherwise, rather unhelpfully / frustratingly(!) your setup works on my machine! (MacOS Mojave 10.14.6)

If you don't make any progress debugging, can you try out the React example on the Opine repo (REF: github.com/asos-craigmorten/opine/...) - if that doesn't work we can get an issue raised and start debugging properly!

Thread Thread
 
christoslitras profile image
Christos Litras

Very strange!
It's not the port, I just tried a different free port (17123) and getting the same error and I don't get anything when I run lsof -ti tcp:3000 on macOS Catalina (10.15.7).

Here is the screenshot of the console and the error:

Deno React SSR hooks error

And Windows terminal screenshot:

Deno React SSR hooks error Windows

How can I debug this?

I also cloned opine and tried to run the example using deno run --allow-net --allow-read --unstable ./examples/react/server.tsx and I got an other error about invalid imports that are using the v infront of versions:

Warning std versions prefixed with 'v' were deprecated recently. Please change your import to https://deno.land/std@0.61.0/encoding/utf8.ts (at https://deno.land/std@v0.61.0/encoding/utf8.ts)
error: Import 'https://deno.land/std@v0.61.0/encoding/utf8.ts' failed: 404 Not Found
    at https://deno.land/x/dejs@0.8.0/vendor/https/deno.land/std/encoding/utf8.ts:1:0
Enter fullscreen mode Exit fullscreen mode

And this again for both Windows and macOS!
Does opine server running on your machine with Deno 1.5.4 without any modifications?