title: How to get Next.js app working with Cloudflare Workers - Workers Sites
body: <p>I am struggling to get an SPA working using Next.js with Cloudflare's Workers Sites. I found a index.js and wrangler file in their document (<a href="https://flareact.com/docs/getting-started#quickstart" rel="nofollow noreferrer">https://flareact.com/docs/getting-started#quickstart</a>) and I am using it but I am getting the browser error - could not find index.html in your content namespace.</p>
  <pre><code>import { handleEvent } from &quot;flareact&quot;;
  
  /**
   * The DEBUG flag will do two things that help during development:
   * 1. we will skip caching on the edge, which makes it easier to
   *    debug.
   * 2. we will return an error message on exception in your Response rather
   *    than the default 404.html page.
   */
  const DEBUG = false;
  
  addEventListener(&quot;fetch&quot;, (event) =&gt; {
    try {
      event.respondWith(
        handleEvent(event, require.context(&quot;./pages/&quot;, true, /\.(js|jsx|ts|tsx)$/), DEBUG)
      );
    } catch (e) {
      if (DEBUG) {
        return event.respondWith(
          new Response(e.message || e.toString(), {
            status: 500,
          })
        );
      }
      event.respondWith(new Response(&quot;Internal Error&quot;, { status: 500 }));
    }
  });
  </code></pre>
  <p>I am using a standard Next.js app</p>