Skip to content

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

@foobar-maker

Description

@foobar-maker

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions