`vercel dev` error: Uncaught TypeError: r.read is not a function
nzoschke opened this issue · comments
First time using deno + vercel. Thanks for the runtime. The examples out of the box aren't working for me
error: Uncaught TypeError: r.read is not a function
const result = await r.read(b);
^
at iter (https://deno.land/std@0.106.0/io/util.ts:250:28)
at iter.next (<anonymous>)
at writeChunkedBody (https://deno.land/std@0.106.0/http/_io.ts:179:20)
at writeResponse (https://deno.land/std@0.106.0/http/_io.ts:286:11)
at async ServerRequest.respond (https://deno.land/std@0.106.0/http/server.ts:87:7)
I suspect bad timing... I'm using the latest vercel-deno@2.0.3
published on npm but the docs and recent PRs refer to v3 with breaking changes.
Ah! Also using oak@v11.1.0
. The example with oak@v9.0.0
works, so investigating differences in that package now.
Having some success like this. I think there are two issues...
vercel-deno@2.0.3
still requires ServerRequestoak@v11.1.0
handle
isn't compatible
import { Application } from "https://deno.land/x/oak@v11.1.0/mod.ts";
import { ServerRequest } from "https://deno.land/std@0.106.0/http/server.ts";
const app = new Application();
app.use((ctx) => {
ctx.response.body = "Hello World!";
});
export default async function (req: ServerRequest) {
const res = await app.handle(req);
req.respond({
body: await res?.text(),
headers: res?.headers,
});
}
vercel-deno@3.0.0
has just been released. Please give it a try, and see the oak
example which is working with the current version of Oak.