816 questions
0
votes
0
answers
8
views
fastify/websockets v11.0.2 and fastify v5.2.1 wont work
I have a fastify project and i want to integrate a websocket.
According to the docs
import { FastifyInstance, FastifyPluginOptions } from 'fastify'
import websocket from '@fastify/websocket'
export ...
0
votes
0
answers
23
views
TypeScript Error: 'authenticate' Property Does Not Exist on FastifyInstance Type When Using JWT
I'm having an issue with my Fastify + TypeScript application. When I try to use the authenticate method in my routes, TypeScript gives me the following error:
Property 'authenticate' does not exist on ...
0
votes
1
answer
27
views
Fastify Route Auto Grouping Issue (CmdProtocol & CloudTask)
When registering routes in Fastify using register(), routes with the same first letter are automatically grouped under a common node.
Code for Route Registration (routes/index.js):
import { ...
0
votes
1
answer
115
views
Socket room event not received in React component
I'm developing a turn based game with React, Fastify and Socket.io for a scholar project.
The player A create a game which create a socket room server-side using the game id as room id. The, he wait ...
1
vote
0
answers
170
views
Supabase Auth exchangeCodeForSession returns "invalid request: both auth code and code verifier should be non-empty"
Architecture:
This is Cross-Platform web-based (SEO focused) project, that was built in CSR due to bad performance using SSR w/ Capacitor framework.
Client: Svelte + Vite + Capacitor
Due to use of ...
1
vote
1
answer
49
views
Fastify response serialization using anyOf is not working properly
I'm having trouble with response serialization.
My controller might return differing values based on the user's state. The schema that I wrote uses anyOf and definition of those schemas that the ...
0
votes
1
answer
65
views
Can't set a cookie with fastify and cross domain
I have two domains registered and I created wild card certs for my backend and frontend.
Both apps are hosted on my machine locally and working fine. The domains get redirected via an entry in /etc/...
1
vote
1
answer
217
views
the best way to run cron jobs with fastify
I had been using fastify-cron to run cron jobs with my fastify4 app. But, it seems the old fastify-cron plugin no longer is compatible with fastify5. What (if any) is the recommended way to run a ...
1
vote
0
answers
44
views
Fastify Passport LocalStrategy: Error 'Expected a string or Buffer' when accessing protected route
I'm implementing a Fastify authentication system using @fastify/passport with a LocalStrategy. Below is the auth plugin that handles user serialization, deserialization, and the local strategy ...
0
votes
0
answers
48
views
migrate express middleware to fastify
I have this middleware that I was making to validate the body of the login request, but it's not working at all, I needed it to say if the email and/or password is missing and return an error before ...
0
votes
0
answers
34
views
Upgrading @nestjs/platform-fastify to version 10.4.15 throws error TS2304: Cannot find name 'RawReply'
On upgrading the package to v10.4.15 from v10.1.3, I see the following errors when i try to build the project:
Fn extends preValidationHookHandler<RawServer, RawRequest, RawReply, RouteGeneric, ...
0
votes
0
answers
61
views
Basic Auth for swagger docs in a Nest.js Fastify app
I am trying to protect the swagger docs alone using basic authentication.
I found this library ( https://www.npmjs.com/package/@fastify/basic-auth ). But I am not able to add authentication for that ...
0
votes
1
answer
98
views
Typescript error in the Fastify Typescript Generics example
Using:
Fastify 5.1.0
Typescript 5.7.2
node 22.10.2 (target es2017)
I'm going through the Fastify 5.1.X Typescript generics tutorial from the Fastify web site (here: https://fastify.dev/docs/latest/...
0
votes
0
answers
29
views
How to provide versions of a package depending on Fastify 4 and on Fastify 5 without duplicating code?
I'm implementing a package which has to start a Fastify server to respond to some requests. Most of its users will be using Node v20+, and so can use Fastify 5, but I don't want to make it a hard ...
0
votes
1
answer
39
views
Fastify ACL PreHandle Middleware Question
I am trying to create a custom ACL middleware in fastify, there is 3 files here I am giving:
authMiddleware.mjs:
import {validateToken} from "../repository/authRepository.mjs";
import {...
0
votes
1
answer
277
views
Type incompatibility issue when registering @fastify/multipart in a NestJS application with Fastify
I am working on a NestJS application using Fastify and I am having trouble registering the @fastify/multipart plugin. Here is my setup:
import multiPart from '@fastify/multipart';
import { ...
0
votes
0
answers
80
views
How to set up fastify multipart to upload documents to google cloud
I am trying to set up a backend using a Fastify server with the fastify-multipart plugin to handle file uploads. I have configured the Fastify server and registered the plugin, but when I try to ...
0
votes
0
answers
70
views
How can I test a Fastify HTTP/2 Cleartext server?
I'm switching a Fastify server using HTTP/1.1 to HTTP/2 Cleartext. I can manually test that it works fine. But all requests in tests using inject() now fail with 505 status code.
Looking at https://...
0
votes
0
answers
133
views
fastify websocket and socketio
i am wroking on a project using fastify
and i am using @fastify/websocket to handle socket connections
and we did merge some parts with another proeject which is using fastify-socket.io
and both libs ...
1
vote
1
answer
207
views
Fastify Autoload with Typescript using Vitest
this is my scenario: I have a Fastify v5 server written in Typescript that I want to test using Vitest.
This is my npm script
vitest run --coverage --outputFile=results.xml
Following what suggested ...
0
votes
1
answer
34
views
Cannot assign to read only property 'name' of function 'function () { [native code] } - Fastify Swagger
I created a simple financial API for a graduation project and I am trying to use Swagger to document the API, but its occurring this error on the Swagger. Can someone help me?
Error in question:
{
&...
0
votes
1
answer
89
views
How to validate twilio signature in fastify
i have been struggling to get the twilio signature validation to work on a fastify server.
Has anyone here implemented the signature validation successfully in fastify, and can give me a quick hand?
...
1
vote
2
answers
251
views
trpc Server-Side Rendering after fetching the data /api
Hello there I'm using trpc and fastify and i have created an api end point to fetch data from prismic cms now I'm confused how to use this fetched data on my pages since I want to render my pages ...
1
vote
0
answers
217
views
How can I log and handle database connection interruptions in a Drizzle ORM?
I'm working on a Fastify server and using Drizzle ORM with postgres-js for database interactions. I have a custom plugin that sets up the main database connection and attaches it to the Fastify ...
2
votes
0
answers
449
views
tsup --watch Rebuilding/Restarting When server.listen is Used in Fastify App on macOS 15.0.1
I'm developing a Fastify application on macOS 15.0.1, and I'm having issues with rebuilding and restarting the app whenever I include server.listen. I’ve tried tsup for watching and rebuilding, but as ...
0
votes
0
answers
165
views
How to validate whatsapp api x-hub-signature-256 in NodeJS?
I'm building a whatsapp chatbot for my company and I'm using Nodejs (with Fastify) + whatsapp cloud api. On the docs, it's saying I don't need to validate the x-hub-signature-256, but as the docs says:...
0
votes
0
answers
33
views
Firebase config file not being considered on transpilation
I have this fastify backend app, it uses typescript. Looks like it's trying to find my firebase configuration (a json file) inside the dist folder (the output folder) but it only exists in the not-...
0
votes
0
answers
144
views
How to resolve TypeScript type mismatch when using Fastify plugin in a Turbo monorepo
I'm building a Fastify plugin as a separate package in a Turbo monorepo using TypeScript and Tsup for bundling. The plugin works at runtime, but TypeScript throws a type mismatch error when trying to ...
1
vote
1
answer
138
views
Using oneOf in OpenAPI response schema
Stack
fastify
Data
Several schemas added using the addSchema method:
server.addSchema({
$id: 'event',
type: 'object',
properties: {
event_id: {
$ref: 'id'
},...
0
votes
0
answers
83
views
Typing Fastify RouteOptions to access queries and reply props
I was trying to use Fastify with typescript in a node project when I was caught in a problem typing the Request and Reply to access on handler function.
This is my code:
import { FastifyReply, ...
0
votes
1
answer
139
views
Fastify Decorator not acting as a preHandler in Fastify-REST-API
I’m fairly new to Fastify, and I’m using it to build an API. I'm having some trouble when using an authentication decorator in a route, which is throwing the following error: "code":"...
0
votes
0
answers
95
views
How to set Content-Type when using @fastify/static?
I use @fastify/static to serve my SPA. Everything works fine when developing. When I deploy behind reverse proxy (Nginx), reverse proxy adds header Content-Type: "text/html" for every file ...
0
votes
1
answer
97
views
"Cannot read properties of undefined" in hooks and open TCP handle after test
I'm working on a Fastify project using Jest and Supertest for end-to-end tests. However, I'm encountering a couple of issues:
TypeError: Cannot read properties of undefined (reading 'length') -
This ...
1
vote
0
answers
56
views
fastify disableRequestLogging not working
I am using fastify 4.24.3.I tried to disable incoming request logs those are autogenerated as shown below.
[App] [17:04:51.617] INFO (31284): incoming request
[App] reqId: "req-1"
[App] ...
0
votes
0
answers
31
views
How to get an image from the backend to the frontend
How to get an image from the backend to the frontend, the image is saved in /public/uploads, I have already installed @fastify/static but my route is 404, below is the code snippet.
app.register(...
0
votes
0
answers
41
views
Implementing Data Observability and Tracing on API Endpoints
I'm looking to set up a system on my API endpoints (Node.js and Fastify) that can trace and log the state of the data at key points in the code, especially for endpoints making SOAP calls to third-...
1
vote
0
answers
31
views
My fastify cookie is not persisting/working in Nextjs app
Me and my friend is working on mobile app project.
Our stack is:
Fastify with TRPC, next js for admin panel, kotlin multiplatform for apps.
I know react next and fastify/trpc. friend is mobile dev.
I ...
0
votes
2
answers
307
views
Fastify plugin usage
I'm studying Fastify and register plugin with @fastify/redis like this
app.register(redisPlugin, {
client: initRedis(app.config.REDIS_INTERNAL__HOST, app.config.REDIS_INTERNAL__PASS),
...
0
votes
0
answers
473
views
"Expected double-quoted property name in JSON at position 32"
I learn more about node.js and fastify when 'send request' the request return this message : "Expected double-quoted property name in JSON at position 32"
how i know where is the problem?
...
0
votes
0
answers
34
views
Reading duplicate emails even after providing timestamp in since in imap-flow?
await imapClient.mailboxOpen("INBOX");
const listOfMessages = await Promise.all(
subjectArrayForMails[tenant].map(async (subject: string) => {
return await imapClient.search({
...
4
votes
1
answer
1k
views
Issues with Delayed Job Processing in BullMQ
I am using BullMQ to add jobs to a queue, which are set to be processed with a 15-second delay. So, I am doing something like this:
// REDIS CONFIG
const redis = new Redis(<REDIS_CONFIG>, {
...
1
vote
1
answer
67
views
Typescript interface instance values are individually undefined
I am a JavaScript and React noob. I am creating a project using TypeScript, React, Sequelize, and postgres for the database.
I am trying to access a request.body member quantity in my post route using ...
0
votes
0
answers
22
views
How can I set bodylimit according to mutations in graphql & redwood & fastify?
I am trying to set the bodylimit according to the mutations in Redwoodjs. I want to set different bodyLimit due to different file sizes.
I tried to use @fastify/multipart with graphql in server.ts but ...
0
votes
0
answers
77
views
No way to add a 'before hook' custom filter depending on an array in AdminJS
What's the problem?
I want to add a before hook on the list action that can pre filter my list of records depending on an array.
In the following example I want to pre filter the list of users ...
0
votes
0
answers
396
views
Convert a schema (@sinclair/typebox) that is in a decorator to type
I'm currently working on a Fastify overlay that I'd like to make, the goal is to develop decorators to create routes quickly. I know fastify-decorators exists, I've been working with it for a long ...
0
votes
0
answers
60
views
Cannot curl to docker chainguard node server using fastify at http://[::1]:80
I have set up a docker container from chainguard running a node server with fastify.
The docker container shows as running:
Server listening at http://[::1]:80
Process id: 7
When I go to localhost I ...
4
votes
1
answer
189
views
Firebase Authentication not working with ADC (Application Default Credentials)
I am using Firebase Admin SDK from my development machine (Node.js/Fastify). So I am trying to do something like this:
Initialize Firebase App 👇:
import * as firebaseAdmin from 'firebase-admin'
...
2
votes
1
answer
220
views
Fastify Swagger not managing enumerators as expected
We are working on a backend with Fastify, declaring schemas with Typebox and generating OpenApi definitions with Fastify Swagger
We are facing some problems with enums or similar during docs ...
0
votes
0
answers
227
views
NestJS how to use Sesion with RedisStore using Fastify?
I have installed NestJS v.10.3.9, Fastify v.4.28.0, @fastify/secure-session v7.5.1 and @fastify/redis v6.2.0 because I need pernament session to save tokens (id tokens/refresh tokens) to protect ...
2
votes
1
answer
67
views
Control nodejs stream data through multiple streams
I am building a fastify server to upload/download files to s3, when I want to download a file I am able to get it using a node stream and return it, so I prevent loading the whole file in memory, I ...