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 Caught exception: FastifyError [FST_ERR_REP_INVALID_PAYLOAD_TYPE]

I'm using Fastify 2.12.1 and I keep getting this FastifyError FST_ERR_REP_INVALID_PAYLOAD_TYPE could someone help me debug this issue. Caught exception: FastifyError [FST_ERR_REP_INVALID_PAYLOAD_TYPE]: FST_ERR_REP_INVALID_PAYLOAD_TYPE: Attempted to…
Akhilraj R
  • 69
  • 5
0
votes
1 answer

How can I revert or rollback the database changes made during testing using 'tap' after test is completed?

I am using tap framework for testing my node application. While running the test I am making some changes in the database. I want to revert all the changes made in the database after testing. Can anyone help me out of this?
Alex Isaac
  • 41
  • 1
  • 5
0
votes
2 answers

Fastify response schema with $merge-keyword throws FST_ERR_SCH_BUILD

When adding a response schema to a fastify resource that leverages the $merge keyword, an error FST_ERR_SCH_BUILD: Failed building the schema for GET: /, due error undefined unsupported is thrown. Schema looks like the following, but the same error…
tuberains
  • 191
  • 9
0
votes
1 answer

How to inject object into route method in Fastify using TypeScript?

I've created the following class controller. class ProjectsController { queryBus: QueryBus; commandBus: CommandBus; constructor(queryBus, commandBus) { this.queryBus = queryBus; this.commandBus = commandBus; } async get(req,…
mkubasz
  • 495
  • 2
  • 7
  • 16
0
votes
1 answer

Fastify: How to call remote url from .get/.post

Currently working on fastify encounter a question that haven't got the solution jet. This is the code currently using. users.js async function routes(fastify, options) { // GET /users/:id fastify.get("/:id", async (req, res) => { // Create a…
Eddwin Paz
  • 2,842
  • 4
  • 28
  • 48
0
votes
1 answer

NestJS/Fastify Cookie Unhandled Promise Rejection Warning

I'm trying to get fastify-cookie working on my NestJS project and I am receiving the following error: (node:38325) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'decorateRequest' of undefined UnhandledPromiseRejectionWarning:…
Ellie G
  • 239
  • 1
  • 4
  • 11
0
votes
4 answers

How to mock Fastify plugin

I am trying to write unit testing for fastify application which also has custom fastify plugin. Is there a way we can mock fastify plugin? I tried mocking using Jest and Sinon without much success.
karthik
  • 1
  • 1
  • 2
0
votes
2 answers

How do I send a HEAD request for a static sendFile in fastify?

When I try to send a HEAD request for sendFile I get the following error: app.head(filePath, { logLevel: LOG_LEVEL }, async (request, reply) => { console.log('head'); try { const { '*': uriPath } = request.params; const isFile =…
Toli
  • 5,547
  • 8
  • 36
  • 56
0
votes
1 answer

How can I forward a mulitpart file stream from fastify-multipart to a 3rd part api?

I have a node api that I'm building that's capable of handling uploads of multipart file types (chunks). This api is based on the Fastify library, and I've already installed the separate Fastify-Multipart library. I've got everything working,…
u84six
  • 4,604
  • 6
  • 38
  • 65
0
votes
1 answer

Fastify schema validation isn't working. Do I have something configured the wrong way?

I'm trying to figure out why the schema validation is not working in Fastify. I have the following code: const postOptions = { schema: { body: { type: 'object', properties: { …
u84six
  • 4,604
  • 6
  • 38
  • 65
0
votes
1 answer

How to use fastify + nestjs + firebase functions

I am using NestJS and Cloud Functions, because of performance I want to switch to Fastify. But I have no idea what to pass to functions.https.onRequest(???) My old code for express is: admin.initializeApp(functions.config().firebase); const server:…
Reza
  • 18,865
  • 13
  • 88
  • 163
0
votes
1 answer

SyntaxError on swagger congif on nodejs fastify

I am getting a syntax error on trying to set up swagger on nodejs app. i use fastify framework for node. my config is based on this tutorial how-to-build-blazing-fast-rest-apis-with-node-js-mongodb-fastify-and-swagger this is my server.js : const…
Fateme Ahmadi
  • 344
  • 1
  • 6
  • 18
0
votes
1 answer

Can Fastify and Express run together?

I have an on-going http service application using Express. Recently I read Fastify and like it. I wonder if it is possible for new features I can use Fastify within the same Nodejs projects? Thanks, Chen
Chen Wang
  • 21
  • 5
0
votes
1 answer

need help to identify issue

Following is my snippet of main.ts try { process.on('unhandledRejection', (err) => { // tslint:disable-next-line:no-console console.error(err); <------- no console }); const app = await…
Mubasshir Pawle
  • 309
  • 1
  • 3
  • 19
0
votes
0 answers

Change type of property in typescript

I have a multiple routes and i want to check if my response is of some type. For response data i need to use res.data, as it easy to pass data like this between app hooks and plugins. Problem is res.data is defined at top level of app and i don't…
ZiiMakc
  • 31,187
  • 24
  • 65
  • 105