Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help: Property does not exist on type Fastify #916

Closed
rslucena opened this issue Aug 10, 2023 · 2 comments
Closed

Help: Property does not exist on type Fastify #916

rslucena opened this issue Aug 10, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@rslucena
Copy link

rslucena commented Aug 10, 2023

馃挰 Question here

I have a doubt in the process of creating plugins. In fact, in the creation and registration of third-party plugins as well.

In a few moments of starting my application I get the following message:

Property '...' does not exist on type 'Fastify...'

*This doesn't always happen

I would like to understand what may be happening, or just have a suggestion on how to debug

//in this example I am registering a third-party plugin, Multipart

import * as fastify from 'fastify'
import fastifyMultipart from '@fastify/multipart'
const Server: FastifyInstance = fastify({
  logger: process.env.APP_SHOWLOG === 'true'
})
Server.register(fastifyMultipart)
export default Server

//...another file
import Server from "service/server"
Server.post('/', (req: FastifyRequest, reply: FastifyReply) => { const Data = await req.file() } )

At some point in the use of what would be the registered object req.file(), or req.files(), in the fastify startup console I get:

error TS2339: Property 'file' does not exist on type 'FastifyRequest<RouteGenericInterface, RawServerDefault, IncomingMessage, FastifySchema, FastifyTypeProviderDefault, unknown, FastifyBaseLogger, ResolveFastifyRequestType<...>>'.

Can you tell me what it could be... In plugins that I also made, using fastify-plugin, the result is the same.

I hope I made it clear, thanks for the help

Your Environment

"@aws-sdk/client-s3": "^3.388.0",
"@fastify/compress": "^6.4.0",
"@fastify/helmet": "^11.0.0",
"@fastify/multipart": "^7.7.2",
"@fastify/rate-limit": "^8.0.1",
"@fastify/swagger": "^8.7.0",
"@fastify/swagger-ui": "^1.9.2",
"@mailchimp/mailchimp_transactional": "^1.0.50",
"@prisma/client": "^5.0.0",
"amqplib": "^0.10.3",
"dotenv": "^16.3.1",
"fastify": "^4.19.2",
"ioredis": "^5.3.2",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"ws": "^8.13.0",
"zod": "^3.21.4",
"zod-to-json-schema": "^3.21.3"
"@types/amqplib": "^0.10.1",
"@types/mailchimp__mailchimp_transactional": "^1.0.5",
"@types/node": "^20.4.5",
"@types/ws": "^8.5.5",
"prisma": "^5.0.0",
"ts-node-dev": "^2.0.0",
"typescript": "^5.1.6"

@rslucena rslucena added the help wanted Extra attention is needed label Aug 10, 2023
@Uzlopak
Copy link

Uzlopak commented Aug 10, 2023

If you dont await the register of the plugin than your whole app is full of race conditions.

@Uzlopak
Copy link

Uzlopak commented Feb 3, 2024

Closing due to inactivity

@Uzlopak Uzlopak closed this as completed Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants