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
1 answer

MongoDB query with 300k documents takes more than 30 seconds

Ok, as said in title, I have "performance issue" where I need to get all documents from a collection but it takes too long. Players collection contains around 300k documents with small size and query in service goes like this: async getAllPlayers()…
Srdan
  • 229
  • 6
  • 12
0
votes
2 answers

Why can't my app run on the intended port in Heroku?

I can't figure out what is the problem with heroku, I've spent 2 days trying to figure out what this error means to no avail. 2021-07-18T04:27:08.741998+00:00 app[web.1]:…
user13121182
0
votes
0 answers

Issues with Fastify Schema and filtering properties

I just started learning fastify today, but there is something about the Schemas and their properties that doesnt work for me as expected! The tutorial i follow showed me how to filter the send properties in the reply from the server : const…
user16458009
0
votes
1 answer

Fastify Route Params required is not honored

I have a route something like this: // collection GET fastify.route({ method: 'GET', url: `${constants.EXTERNAL_PATH}/:serviceName/:collectionName/account/:accountId`, schema: { description: 'Get all…
Pradip
  • 509
  • 1
  • 5
  • 22
0
votes
1 answer

Fastify swagger doc is generating a OPTIONS API in swagger doc under default tag

I am facing an weird issue. In my swagger doc, I am always seeing default OPTIONS API is getting listed without any specification from my routes. I am registering fastify-cors which seems the issue. fastify.register(require('fastify-cors'),…
Pradip
  • 509
  • 1
  • 5
  • 22
0
votes
1 answer

Redis zrangebyscore and zincrby under high concurrency

I am facing concurrency problem with redis, my API is build on Nodejs Fastify and i am using fastify-redis in my API call. I am using two simple methods of redis ZRANGEBYSCORE and ZINCRBY The problem is under high concurrency ZINCRBY is executed…
0
votes
1 answer

Fastify equivalent of express-mongo-sanitize

Hello Fastify Experts, In MongoDB queries I can pass various operators, which may risks the security aspect by having various attack surfaces. So before sending the payload, I would like to sanitize the query/filters/sort etc. However I don't think…
Pradip
  • 509
  • 1
  • 5
  • 22
0
votes
1 answer

Can't dependency inject service in revolver

I'm unable to use a service with a resolver in the same module. I have looked at this for at least an hour now and can't figure out what's wrong. The auth service is in the providers array of the auth module so the auth resolver should be able to…
Isak
  • 548
  • 2
  • 5
  • 20
0
votes
0 answers

Full Text Search Fastify with Mongoose

Im trying to get a Full Text Search working through Fastify and Mongoose. But it returns an empty array. There is no info online about this, so I just played with it for a while. in db.ts I set the: useCreateIndex: true The Model…
dash
  • 387
  • 1
  • 11
0
votes
1 answer

I want use schema in fastify routes but its returning empty object but if i comment schema code it is working correctly

I want use schema in fastify routes but its returning empty object but if i comment schema code it is working correctly router array containing routes and i have looped on it const routes = [ { method: 'GET', handler:…
Shadab Ali
  • 369
  • 3
  • 10
0
votes
1 answer

Node.js vercel/pkg express 'return 0 error' and fastify errors. Error: File or folder not included into executable during compilation stage

When trying to compile your node project into an executable and you are using express for routing it may lead to an error like the one shown below: john@john:~/Tofa/Projects/Convert node project into .exe/Secondtest/express$ ./express Error: File or…
Chris Mutua
  • 123
  • 2
  • 6
0
votes
1 answer

set multiple headers with fastify

i wish to set the same header as the following one but with fastify framework // working example with express const head = { 'Content-Range': `bytes ${start}-${end}/${fileSize}`, 'Accept-Ranges': 'bytes', …
Jerome
  • 294
  • 2
  • 14
0
votes
2 answers

Fastify test unit keeps getting timed out (Node Tap)

I am testing a NodeJS app on Fastify , using Node Tap. I'm new to both platforms. The test case unit is supposed to connect to graphql and run a sample query. I can see that the query is executed and the test assertions being passed successfully…
M H
  • 1
  • 2
0
votes
1 answer

Fastify: Ommit some APIs from using basic authentication

Currently, I have two APIs: /auth and /no-auth. I would like ONLY one of them to use basic-auth. I am using fastify-basic-auth plugin on top of fastify in node. /auth should require authentication. /no-auth should NOT require…
Eduardo Morales
  • 764
  • 7
  • 29
0
votes
1 answer

fastify-multipart crashes service

I'm trying to get a Multipart POST to work with fastify-multipart, but whenever I post a multipart file to the endpoint my service crashes with the following error: req.raw[kMultipart] = true ^ TypeError: Cannot set property…
chris
  • 600
  • 7
  • 21