Skip to content

Help - how you import / use fastify on Deno #1071

Closed as not planned
Closed as not planned
@mrymahmadi

Description

@mrymahmadi

i used
import Fastify, { FastifyReply, FastifyRequest } from "npm:fastify";
and
import Fastify from "https://deno.land/x/fastify";

my server index.ts:
import Fastify, { FastifyReply, FastifyRequest } from "npm:fastify";
const fastify = Fastify({ logger: true });

fastify.get("/", () => {
return "Hello world!";
});

fastify.listen({ host: "0.0.0.0", port: 80 }, (error, address) => {
if (error) {
console.error(error);
Deno.exit(1);
}
console.info(Server started. Listening on ${address});
});

but i when run project, received this message:
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'node')
at Object. (file://.cache/deno/npm/registry.npmjs.org/sonic-boom/4.2.0/index.js:20:42)
at Object. (file://.cache/deno/npm/registry.npmjs.org/sonic-boom/4.2.0/index.js:721:4)
at Module._compile (node:module:748:34)
at Object.Module._extensions..js (node:module:767:10)
at Module.load (node:module:665:32)
at Function.Module._load (node:module:537:12)
at Module.require (node:module:684:19)
at require (node:module:808:16)
at Object. (file://.cache/deno/npm/registry.npmjs.org/pino/9.5.0/lib/tools.js:7:19)
at Object. (file://.cache/deno/npm/registry.npmjs.org/pino/9.5.0/lib/tools.js:396:4)

Deno version: 2.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions