<p dir="auto">The following snippets will cause errors. After removing <code class="notranslate">req.clone</code> it will be fine, so 100% req.clone is the source of issue.</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Deno.serve(opts, (req) =&gt; {
	console.log('check req', req.clone())
	return new Response()
})"><pre class="notranslate"><span class="pl-smi">Deno</span><span class="pl-kos">.</span><span class="pl-en">serve</span><span class="pl-kos">(</span><span class="pl-s1">opts</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-s1">req</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
	<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'check req'</span><span class="pl-kos">,</span> <span class="pl-s1">req</span><span class="pl-kos">.</span><span class="pl-en">clone</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
	<span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-smi">Response</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="TypeError: Array.prototype.map called on null or undefined
    at map (&lt;anonymous&gt;)
    at cloneInnerRequest (deno:ext/fetch/23_request.js:164:9)
    at Request.clone (deno:ext/fetch/23_request.js:489:18)
    at Object.serve (deno:ext/flash/01_http.js:543:22)
    at async Promise.all (index 0)
    at async Object.serve (deno:ext/flash/01_http.js:619:5)"><pre class="notranslate">TypeError: Array.prototype.map called on null or undefined
    at map (<span class="pl-k">&lt;</span>anonymous<span class="pl-k">&gt;</span>)
    at cloneInnerRequest (deno:ext/fetch/23_request.js:164:9)
    at Request.clone (deno:ext/fetch/23_request.js:489:18)
    at Object.serve (deno:ext/flash/01_http.js:543:22)
    at async Promise.all (index 0)
    at async Object.serve (deno:ext/flash/01_http.js:619:5)</pre></div>
<h3 dir="auto">Description</h3>
<p dir="auto">When running <code class="notranslate">deno bundle</code> on the example code in the front page of <a href="http://deno.land/" rel="nofollow">http://deno.land/</a> the resulting code is invalid and throws a syntax error when running it with <code class="notranslate">deno run</code>.<br>
The code example is the following:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { serve } from &quot;https://deno.land/std@0.61.0/http/server.ts&quot;;
const s = serve({ port: 8000 });
console.log(&quot;http://localhost:8000/&quot;);
for await (const req of s) {
  req.respond({ body: &quot;Hello World\n&quot; });
}"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">serve</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"https://deno.land/std@0.61.0/http/server.ts"</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-en">serve</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">port</span>: <span class="pl-c1">8000</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">"http://localhost:8000/"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">for</span> <span class="pl-k">await</span> <span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-s1">req</span> <span class="pl-k">of</span> <span class="pl-s1">s</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-s1">req</span><span class="pl-kos">.</span><span class="pl-en">respond</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">body</span>: <span class="pl-s">"Hello World\n"</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Environment</h3>
<p dir="auto">This was tested on Deno 1.2.0 on both Windows 10 installed using the powershell script on the front page, and Arch Linux installed using the aur package <code class="notranslate">deno-bin</code>.<br>
<code class="notranslate">deno --version</code> on windows reports the following:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="deno 1.2.0
v8 8.5.216
typescript 3.9.2"><pre class="notranslate"><code class="notranslate">deno 1.2.0
v8 8.5.216
typescript 3.9.2
</code></pre></div>
<h3 dir="auto">Steps to reproduce</h3>
<ol dir="auto">
<li>Save the example code to a file <code class="notranslate">server.ts</code></li>
<li>Run the command <code class="notranslate">deno bundle server.ts server.bundle.js</code></li>
<li>Run the command <code class="notranslate">deno run --allow-net server.bundle.js</code></li>
</ol>
<h3 dir="auto">Expected Behaviour</h3>
<p dir="auto">The code should run correctly. The original does work when executing <code class="notranslate">deno run --allow-net server.ts</code> (<code class="notranslate">server.ts</code> being the original code example)</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">The command fails throwing a <code class="notranslate">SyntaxError</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: Uncaught SyntaxError: Unexpected reserved word
            for await (const req of s) {
                ~~~~~
    at file:///&lt;redacted path&gt;/server.bundle.js:1715:17"><pre class="notranslate"><code class="notranslate">error: Uncaught SyntaxError: Unexpected reserved word
            for await (const req of s) {
                ~~~~~
    at file:///&lt;redacted path&gt;/server.bundle.js:1715:17
</code></pre></div>
<h3 dir="auto">Cause</h3>
<p dir="auto">When inspecting the emitted code <code class="notranslate">server.bundle.js</code>, at the line reported in the error there is an invalid <code class="notranslate">await</code> keyword in the scope of a non-<code class="notranslate">async</code> function.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="execute: function () {
  s = server_ts_2.serve({ port: 8000 });
  console.log(&quot;http://localhost:8000/&quot;);
  for await (const req of s) {
    req.respond({ body: &quot;Hello World\n&quot; });
  }
}"><pre class="notranslate">execute: <span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-s1">server_ts_2</span><span class="pl-kos">.</span><span class="pl-en">serve</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">port</span>: <span class="pl-c1">8000</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">"http://localhost:8000/"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">for</span> <span class="pl-k">await</span> <span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-s1">req</span> <span class="pl-k">of</span> <span class="pl-s1">s</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-s1">req</span><span class="pl-kos">.</span><span class="pl-en">respond</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">body</span>: <span class="pl-s">"Hello World\n"</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>