Questions tagged [fastify]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

How to properly authenticate user with next 13 RSC?

I'm trying to enroll my own auth with a separate backend using fastify and next 13 for the frontend. I used JWT with http secure token to authenticate the user after logging in. I send the token in ...
theos's user avatar
  • 1
0 votes
0 answers
12 views

Using subdomains in NestJS with Fastify Adapter?

The docs state that Fastify doesn't support nested routers, however they do support a Route Config which in theory should allow me to use constraints to limit a route to a sub domain, such as the ...
Kyle's user avatar
  • 4,347
0 votes
0 answers
14 views

Fastify to SQL Database (From a form)

FASTIFY USED IN GLITCH.COM! Basically, I am a rookie at backend. I have a server.js, which reads an index.ejs file. In this index.ejs file, i have a form which takes in as an input the user's email. ...
Mridin's user avatar
  • 1
0 votes
0 answers
7 views

Fastify Swagger & TypeScript: How to put schema for a route returning a ReadableStream of objects

A Fastify endpoint (using TS) returns a ReadableStream of objects. Apparently there is no way to tell in response schema that this endpoint returns a stream of objects. How do we create the route to ...
Toseef Zafar's user avatar
  • 1,601
0 votes
0 answers
27 views

Why socket.io does not work with fastify?

When I try to connect from a client to socket.io I get the following error: polling.js:321 GET http://localhost:4999/socket.io/?EIO=4&transport=polling&t=OheO-bi 404 (Not Found) Here's my ...
lofdom's user avatar
  • 1
0 votes
1 answer
17 views

Sentry performance tracing not working with Fastify on Node

Tried following Sentry's tutorial on adding performance traces but it seems Sentry support is still WIP for Fastify. Here's what I did based on Sentry's documentation: const sentryIntegrations = [ ...
CommonSenseCode's user avatar
0 votes
1 answer
41 views

Not use await to run fastify/swagger

I try to use fastify/swagger to build my API document, it works and this is my code. The problem is, it only gets/route2, but cannot get /route1. Any suggestion of it? 'use strict' const fastify = ...
Dennys's user avatar
  • 599
0 votes
0 answers
42 views

Typescript - React and NextJS + NextAuth with custom server

I'm building a NextJS application with NextAuth to manage authentication session, I'm also using a custom server written in typescript and using FastifyJS. It works well except for NextAuth ...
Lollo's user avatar
  • 545
0 votes
1 answer
27 views

'AVV_ERR_PLUGIN_NOT_VALID' error in fastify

i was trying to set up the environmental variables in my fastify - react app. why am I getting the 'AVV_ERR_PLUGIN_NOT_VALID' error for the following fastify code? thank you! : const fastify = require(...
Toto's user avatar
  • 13
0 votes
1 answer
32 views

view engine in nestjs fastify

I am trying to implement ejs in nestjs fastify microservice. I have an issue with setViewEngine. app.setViewEngine({ engine: { ejs }, templates: join(__dirname, '..', 'src', 'views'), }); ...
excitedHipster's user avatar
0 votes
0 answers
12 views

how sanitize the input when set up micro service using mercurius graphql based on fastify

I create micro service using mercurius based on fastify, Now i create a plugin to sanitize all the input by hooking onRequest 'use strict' const fp = require('fastify-plugin') const mongoSanitize ...
davis du's user avatar
0 votes
1 answer
52 views

Fastify cant post or get Data

acctualy, i dont know why its not work but i guess the flow is right. when server running well on port 3000, im trying get data using postman (http://localhost:3000/api/user/) but i cant get ...
Wildy Simanjuntak's user avatar
0 votes
1 answer
21 views

Fastify insists on sending plain text instead of html

I cannot understand why this: import fs from 'fs' import path from 'path' ... const file = fs.readFileSync(path.join('/path/to/folder', 'index.html')) reply.headers({ 'content-type': 'text/html; ...
user4893295's user avatar
0 votes
1 answer
42 views

fastify-openapi-glue FastifyError: ... strict mode: unknown keyword: "example"

I have upgraded from Fastify v3 to v4, which I use to serve mock apis based on OpenAPI/swagger by using the plugin fastify-openapi-glue. Since the upgrade, I receive the error FastifyError [Error]: ...
Markus's user avatar
  • 1,081
0 votes
0 answers
29 views

Dependecy injection error on instance controller

import {ViaCepService} from "../../services/viacep/viaCepService"; export class ViaCepController { private viaCepService: ViaCepService = new ViaCepService() async buscarCep(req, reply) { ...
Rodrigo Duarte's user avatar
1 vote
2 answers
37 views

Combine multiple schemas in fluent-json-schema

I'm defining some routing schemes for fastify. I would like to reuse the code of some schema by combining them together without making redundancy. How can I combine two patterns into one? const ...
stefcud's user avatar
  • 2,232
0 votes
0 answers
51 views

Error while starting webpack dev server over nodejs fastify

command: "build": "webpack --config ./webpack.development.js" "start": "fastify start -l debug --options dist/bundle.js", error: AvvioError \[Error\]: ...
BBB's user avatar
  • 1
-2 votes
0 answers
25 views

Dockerized Node app isn't starting on container start

I'm trying to containerize my Node app, but the process isn't starting on container start. Dockerfile: FROM node:16.14.2 WORKDIR /app COPY package*.json /app RUN npm ci --omit=dev COPY . /app ...
Switch386's user avatar
  • 449
0 votes
1 answer
51 views

Fastify & socket.io server client doesn't connect

How can we connect fastify backend server with socket.io ? Can anyone suggest me what I did wrong in following code? Error Code:- "res": {"statusCode": 404} index.html <!...
Sagar Betkar's user avatar
1 vote
0 answers
23 views

Browser not seting cookie to client domain but server domain only

I have 2 projects, app client and api server. When i request from server cookie i receive it under set-cookie but for some reason browser does not set it under its app domain but continue setting it ...
Marius's user avatar
  • 1,646
0 votes
1 answer
98 views

Mock fastify auth plugin in node tap using sinon

I'm trying to mock the return value of a fastify-auth plugin using Sinon but seems like I am missing something. Here is my implementation: // routes.js const fastifyAuth = require('fastify-auth') ...
Hamza Boularbah's user avatar
0 votes
0 answers
50 views

Http requests randomly hanging in browser, what are possible causes?

I have a very unusual issue, my web application (Made with ReactJS, Webpack and a Fastify backend) sometimes hangs infinitely (request pending) after making a request to the backend API. Fastify ...
Jean-Samuel Girard's user avatar
0 votes
1 answer
47 views

Could someone help me to create a HOOK in FASTIFY to automatically serialize these types of values ​in all app.ts endpoints?

Could someone help me to create a HOOK in FASTIFY to automatically serialize these types of values ​​in all app.ts endpoints I managed to solve the problem using .toString, but I wanted a way to do ...
Brayan Vinicius Jordan's user avatar
0 votes
1 answer
102 views

Fastify disable schema validation

I'm looking for the best way to disable programmatically the json-schema validation for all routes in a fastify instance: module.exports = async (fastify, opts) => { fastify.get('/stations.json', ...
stefcud's user avatar
  • 2,232
0 votes
0 answers
37 views

How to Properly Select Specific Fields in Mikro-ORM for MongoDB to Avoid Circular References?

I'm using NestJS with Fastify and Mikro-ORM (for MongoDB) and I'm facing an issue related to circular references when trying to serialize my entities. Here are simplified versions of my primary ...
Darshana Sandaruwan's user avatar
0 votes
0 answers
24 views

File Upload on apollo gateway

I have two graphql subgraphs server a and server b. Each running fastify and mercurius and using grapqql-upload to handle files. I also have an apollo gateway connected to both servers and working ...
Cyrille keith's user avatar
0 votes
0 answers
27 views

Mercurius-codegen error Cannot find name '_Service

I am implementing a graphql api subgraph using Mercuriusjs, @mercurius/federation and typescript by following their doc. But always getting error Here are some parts of my code. server.ts const app = ...
Jules Betfien's user avatar
1 vote
1 answer
59 views

How to create my wrapper function for library's inline function and pass inline function's type?

I have a simple Fastify route fastify.post( 'v1/article', { schema: {...}, }, async (request, reply) => { reply.send("ok"); } ); I ...
Bright Lee's user avatar
  • 2,306
1 vote
1 answer
23 views

Disable NestInterceptor auto stringify

I'm using the following NestInterceptor to add code, message and data to final response: export class HttpResponseInterceptor implements NestInterceptor { intercept(context: ExecutionContext, next:...
Hhry's user avatar
  • 833
0 votes
0 answers
24 views

How to pass schemas to children using @fastify/autoload?

I have a folder for routes, what has different classes. Each class has it's own index.ts and schemas.ts. Folder structure: ├───routes │ │ ├───db │ │ │ ├───param1 | │ │ │ └─index.ts (...
donaldtheduckkk00's user avatar
0 votes
0 answers
30 views

How do I attach a `project` key to a request in Fastify?

I'm trying to figure out how to attach a project object to the request using middleware + properly type it using Typescript. Here's an example: const MOUNT = { prefix: "/project/:pid/job/" } ...
Foobar's user avatar
  • 7,550
0 votes
1 answer
120 views

Nodejs Fastify call function in handler from a cron job

We have a web application using Fastify. There is a function in a handler that we need to call it from a cron job inside the same application. index.js async function registerRoutes(fastify) { ...
Jose Antonio's user avatar
0 votes
1 answer
75 views

Strange behavior of js object. Can't get a value from a key

Faced a small problem while writing a backend on fastify + postgres. I have a user registration function on a website that under the hood contributes data to Postgres. I am now optimizing error ...
Georgii Galechyan's user avatar
0 votes
0 answers
35 views

Error are not caught properly when using a centralized prisma client for the application

I'm currently working using an approach where I'm using a centralized prisma client. db.js const { PrismaClient } = require("@prisma/client"); const prisma = new PrismaClient(); module....
rohit kumar's user avatar
0 votes
1 answer
43 views

Generating the openapi.yml file after passing the tests

After finishing all tests (in tap) I would like to run a script that generates openapi.yml. In the .taprc config, I added the after property: after: utils/generateOpenApi.ts and my script (utils/...
Bart Krakowski's user avatar
0 votes
0 answers
32 views

Customize pino/pino-pretty in fastify-cli

I have a fastify v4 app being developed with fadtify-cli. How do I customize pino logger settings in the cli environment? I have lots of working examples with the logger being on the server (where ...
Energetic Pixels's user avatar
0 votes
0 answers
95 views

Fastify prehandler (middleware) are running in concurrency with handler when use await

I'm using Fastify (with typescript) and I want to make a middleware with validation in async flow before call the handler I implemented a hook called validateUser and if I throw some error after any ...
Renato Cassino's user avatar
0 votes
1 answer
67 views

Unable to Access User Object with fastify Adapter Using StrategyCreatedStatic for Authorization in NestJS

I'm using StrategyCreatedStatic from passport to create a custom authorization strategy in NestJS. In my implementation, I call this.success(user, info) at a certain point. My endpoint is protected ...
Yetispapa's user avatar
  • 2,184
0 votes
2 answers
93 views

Nodejs + firebase: how to check if user is authenticated server side

User is authenticated on client side with firebase sdk. on server side, there is nodejs with also the sdk installed. This server code is valid as i'm able to use the db: var firebase = require("...
Robert Brax's user avatar
  • 6,578
0 votes
1 answer
34 views

http://localhost:8895 is returning This page isn’t working even if everything seems ok

I am working with MacOs. This is my fastify code const fastify = require('fastify')({ logger: true }) fastify.get('/ping', (req, reply) => { reply.send({ pong: "pong" }) ...
sensorario's user avatar
  • 20.3k
0 votes
1 answer
60 views

Fastify opentelemetry missing full coverage

We have built a Node.js API based on Fastify and GraphQL. (Without apollo) The API supports gzip compression. The API has an opentelemetry instrumentation which we use to analyse the request times. We ...
Peter Kusza's user avatar
0 votes
0 answers
88 views

Why this error shows up Missing handler function for \"GET:/enteredUsers\" route. in fastify.js

I am making an API to process fingerprint data coming from esp32. My code was working fine until I have one route when I added the second route it is continuously giving error and I am not getting it ...
Muhammad Umar's user avatar
0 votes
0 answers
27 views

How can i relate Fastify-Basic-Auth api with Frontend Angular

i tried to implement login to my project, I'm using Fastify server, typeORM schema and zod validation, I implemented the API and front side, but when i login,the routes in front side are accessible ...
mima ouamen's user avatar
0 votes
1 answer
83 views

Raw body verification in stripe

I am trying to access the raw body in Fastify for verification in Stripe. But, I am not able to do it in any way. I tried most of the solutions mentioned here. This is how I am registering the ...
Joy Gupta's user avatar
  • 122
0 votes
0 answers
57 views

Use PGP_SYM_ENCRYPT function with node-postgres (fastify)

I'm trying to use the PGP_SYM_ENCRYPT function to save encrypted data in a PostgreSQL database using Fastify. The pgcrypto extension has been added using this command CREATE EXTENSION IF NOT EXISTS ...
Geeogee's user avatar
  • 41
0 votes
1 answer
65 views

Fail to access the fastify app running on Google Cloud virtual machine

After many attempts to solve the issue, I turn for your help friends. I cannot access the simple "hello world" fastify app running on a Google Cloud virtual machine. The app is listening on ...
Toto's user avatar
  • 13
0 votes
0 answers
137 views

Fastify + Swagger $ref usage in routes

How should I use the $ref when defining routes? This way it throws: FastifyError [Error]: Failed building the serialization schema for GET: /route, due to error Cannot find reference "Data" ...
donaldtheduckkk00's user avatar
0 votes
1 answer
228 views

Fastify Websocket - How to get the current connected clients?

I am trying to get the current users connected to the websocket server. this is my code register websocket fastify.register(FastifyWebsocket, { options: { clientTracking: true } }); setup ...
Evan's user avatar
  • 2,367
-1 votes
1 answer
121 views

How to securly verify user by passwordless magic link?

Problem: I am in the process of creating a straightforward passwordless authentication system for users to perform basic CRUD operations. Approach The overall login process is as follows: The user ...
IvonaK's user avatar
  • 129
0 votes
1 answer
199 views

Node.js : Stream file with @fastify/multipart to AWS S3 throw the error "A header you provided implies functionality that is not implemented"

I have a fastify app with a route /api/upload where I upload an image, using the @fastify/multipart npm package. The handler for this route basically use the stream of the file to upload directly to ...
AndroidUserOnAppleDevice's user avatar

1
2 3 4 5
14