didiercrunchD
Denoβ€’3y agoβ€’
5 replies
didiercrunch

Basic react server side rendering does not work on Deno Deploy but does locally

The below application work correctly locally but fails on Deno Deploy. On Deno Deploy, all my responses have a status 500 and logs show an error ReferenceError: h is not defined at handler (file:///src/server.tsx:8:33).


import React from "https://esm.sh/react@18.2.0";

// @deno-types="https://denopkg.com/soremwar/deno_types/react-dom/v16.13.1/server.d.ts"
import ReactDOMServer from "https://esm.sh/react-dom@18.2.0/server";


const handler = (request: Request): Response => {
    const body = ReactDOMServer.renderToStaticMarkup(
        <div >hello world</div>
    );
    return new Response(body, {status: 200});
};

Deno.serve(handler);


I am sure that I am doing something stupid but I cannot figure out what. Can you help me spot it.

cheers,

didier
Was this page helpful?