deno icon indicating copy to clipboard operation
deno copied to clipboard

Fastify works but prints message "Not implemented: Server.setTimeout()"

Open foobar-maker opened this issue 2 months ago • 3 comments

Version: Deno 2.5.6

The simpliest example with Fastify works but prints message in console `Not implemented: Server.setTimeout()``

main.ts

import Fastify, { type FastifyReply, type FastifyRequest } from "fastify";

const fastify = Fastify();

fastify.get("/", async (_: FastifyRequest, res: FastifyReply) => {
  res.send("Hello World!");
});

// Run the server!
fastify.listen({ port: 3000 }, function (err, address) {
  if (err) {
    fastify.log.error(err);
    Deno.exit(1);
  }
  // Server is now listening on ${address}
  console.log(`Server is now listening on ${address}`);
});

deno.json

{
  "tasks": {
    "dev": "deno run --allow-net --allow-sys --allow-env --watch main.ts",
  },
  "imports": {
    "fastify": "npm:fastify@^5.6.1",
  },
}

A workaround suggested by Chatgpt doesn't work

// make Deno's polyfilled http.Server.setTimeout a no-op
// (must be done before .listen)
(fastify.server as any).setTimeout = () => fastify.server;

foobar-maker avatar Nov 07 '25 07:11 foobar-maker

Apparently the error comes from here: https://github.com/denoland/deno/blob/d21201e2a0c022db4d370c447ec44e224a8808ed/ext/node/polyfills/http.ts#L2160-L2163

Tango992 avatar Nov 08 '25 11:11 Tango992

hey @foobar-maker I’d like to work on this issue. The root cause is that Server.setTimeout() in the Node http polyfill logs a “Not implemented” message. I plan to make it a no-op for compatibility (matching Node’s behavior).

gothamsidd avatar Nov 11 '25 12:11 gothamsidd

Hi @gothamsidd, @Tango992 Could you please assign this issue to me? I'd like to work on it.

Karthikeya1500 avatar Nov 18 '25 16:11 Karthikeya1500