Questions tagged [fastify]

Fast and low overhead web framework for Node.js (https://www.fastify.io)

Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture. It is inspired by Hapi and Express.

The official website of Fastify is www.fastify.io. The source can be found on GitHub.

Useful links:

Older versions

671 questions
0
votes
0 answers

fastify-cors plugin with TypeScript: 'origin' is not defined

Trying to set up CORS for fastify vai the fastify-plugin in a fairly strict typescript environment. The docs showing the async configuration https://github.com/fastify/fastify-cors#configuring-cors-asynchronously import fp from…
Bill
  • 4,614
  • 13
  • 77
  • 132
0
votes
0 answers

Adding doc in REST API using fastify

I am currently using fastify (3.20.1) and fastify-swagger(4.8.4). The situation is: I can add all the REST API verbs (PUT, PATCH, DELETE etc.) in my route specification in JavaScript Node Js. Now I want to add a customized stuff like "Doc" in every…
Pradip
  • 509
  • 1
  • 5
  • 22
0
votes
1 answer

How to test post route in fastify?

I'm using fastify-cli. I already created a routed post. Its work normally when I call it from Postman, but not working when I call it from test command. It says FST_ERR_CTP_INVALID_MEDIA_TYPE. Where is my mistake? const UserCreate = { email:…
Herman
  • 67
  • 2
  • 5
0
votes
1 answer

how to change video fps/bitrate from backend side after uploading using node js means it should change live from 144p to 240p, in video

how to change video fps/bitrate from backend side after uploading using node js means it should change live from 144p to 240p means it should goes up to down in all quality, in video Blockquote
Goku Dbz
  • 1
  • 1
0
votes
1 answer

Nodejs spawn stdout as api response

I am writing a fastify post api which will take request, and then it will run a bat file with the request as the argument and I want to send the stdout from the spawn process to be sent as api response, one after another, like it shows in the…
0
votes
1 answer

NestJS: Type 'NestFastifyApplication' does not satisfy the constraint 'INestApplication'

I'm building a back-end application with NestJS and I'm trying to use fastify instead of express as the underlying framework. I'm following the documentation (available here) to use fastify, however I got the following type issue: Type…
AndreaCostanzo1
  • 1,799
  • 1
  • 12
  • 30
0
votes
1 answer

fastify-jwt sign token with user ID payload

I'm making a simple sign-in function, that will return a token with the user's ID. I've registered the fastify-jwt on the fastify instance with the key and added user id in the call to the sign function. Code auth.js import Fastify from…
Evan
  • 2,327
  • 5
  • 31
  • 63
0
votes
0 answers

Simple http server in nodejs: response time 1 millisecond is a lot?

I wrote the simplest http server on a nodejs (v15.11) and fastify (v3.20.2) (as one of the most productive libraries on a node for this purpose). And the results are somewhat depressing for me: when sending 1 request, response time +/- 1…
Alexander
  • 409
  • 4
  • 11
0
votes
1 answer

Nest + Fastify + fasity-next + TypeOrm cannot find next() function

I am trying to initialize Nest with Fastify and Next using the fastify-next plugin, everything was okay until I integrated TypeOrm (MongoDB). When Nest loads the AppModule it throws an error that says the .next() function is not found in the fastify…
bek
  • 195
  • 5
  • 15
0
votes
2 answers

How do I extend Request's interface in Fastify with TypeScript

I have this declaration file in the project's root called fastify.d.ts: import { auth } from "firebase-admin"; declare module 'fastify' { interface FastifyRequest { user: auth.DecodedIdToken } } And I've been using to set a user to an…
Stan Loona
  • 615
  • 9
  • 18
0
votes
0 answers

Configuring Fastify with OpenAPI 3.0.0

In my project my intention is to configure fastify-swagger with OpenAPI version 3.0.0 with the following configuration: I am using fastify-oas as fastify plugin such that my existing configuration does not need to alter. const swaggerConfig = { …
Pradip
  • 509
  • 1
  • 5
  • 22
0
votes
1 answer

Open API schema conditional response field based on the presence of a query parameter

I am working on providing a GET REST API where I would like to conditionally include the total_documents field (its an integer count of the total number of records present in the DB table). The API signature and response payload will be something…
Pradip
  • 509
  • 1
  • 5
  • 22
0
votes
1 answer

How to handle "UnhandledPromiseRejectionWarning" in Fastify without "async / await" or ".catch"

I'm running a simple Fastify server and when I make a request and it fails, I wanna handle that exception in the setErrorHandler. How can I achieve that? This doesn't seem to work: import fastify from 'fastify'; import fetch from…
Rodrigo Ruiz
  • 4,248
  • 6
  • 43
  • 75
0
votes
0 answers

GCP Pubsub batch publishing triggering 3 to 4x time messages than actual number of messages

I am trying to publish messages via google pubsub batch publishing feature. The batch publishing code looks like below. const gRPC = require("grpc"); const { PubSub } = require("@google-cloud/pubsub"); const createPublishEventsInBatch = (topic) =>…
viz_tm
  • 115
  • 1
  • 1
  • 7
0
votes
0 answers

TypeError: Cannot convert undefined or null to object on NodeJs (fastify) deployment

I'm trying to deploy a NodeJs project (fastify framework) on linux server. the problem is after deploying it for every request it returns 500 error with error below: TypeError: Cannot convert undefined or null to object at Function.keys…