Fastify v3 release: https://github.com/fastify/fastify/releases/tag/v3.0.0
This should take too much work. There aren't many breaking changes in fastify 3. I'll try my hand at a PR if no one else does by this weekend.
I hope this does get updated, updating components that are fastify based like fastify-swagger and fastify-multipart gets broken since it requires Fastify v3.
I can make a try tonight. Doesn't seem like too much work.
What's maybe worth mentioning is that there's an issue in apollo-server-fastify
, making GraphQL Playground never work: https://github.com/apollographql/apollo-server/issues/4122. I'd started working on a fix but tbh for our use (_just_ fastify & graphql, sans NestJS) fastify-gql
is probably a better fit.
Still waiting for https://github.com/apollographql/apollo-server/issues/4355
7.4.0 is compatible with 3.0.0 now
Hello, after updating to 7.4.0 we got this error
node_modules/@nestjs/platform-fastify/adapters/fastify-adapter.d.ts:10:36 - error TS2307: Cannot find module 'point-of-view' or its corresponding type declarations.
10 import { PointOfViewOptions } from 'point-of-view';
~~~~~~~~~~~~~~~
I can confirm on a fresh nest project using fastify, the application is not able to start without installing point-of-view
and fastify-static
. For now as a workaround you can either downgrade to 7.3.x or you can install these two packages.
Thanks for reporting @AcidSlide @jmcdo29. It should be fixed in 7.4.1
Works great! Thanks for the quick fix
Hi @kamilmysliwiec still broken for me in 7.4.1.. the Fastify Options doesn't work anymore, i've tried even the most basic options which is enabling the logger (as based on https://docs.nestjs.com/techniques/performance#fastify-options)
src/main.ts:57:24 - error TS2345: Argument of type '{ logger: true; }' is not assignable to parameter of type 'FastifyInstance<Server, IncomingMessage, ServerResponse, FastifyLoggerInstance> | FastifyHttp2Options<...>'.
Type '{ logger: true; }' is not assignable to type 'FastifyHttp2Options<Server, FastifyLoggerInstance>'.
Property 'http2' is missing in type '{ logger: true; }' but required in type '{ http2: true; http2SessionTimeout?: number; }'.
57 new FastifyAdapter({
~
58 logger: true,
~~~~~~~~~~~~~~~~~~~
59 }),
~~~~~
node_modules/@nestjs/platform-fastify/adapters/fastify-adapter.d.ts:15:5
15 http2: true;
~~~~~
'http2' is declared here.
Found 1 error(s).
Fixed in 7.4.2
Thanks @kamilmysliwiec confirming it works.. now I just need to find a way to make fastify-multipart work ahahaha
Hmmm.. it looks like we can't register the fastify-multipart plugin with the FastifyAdaptor anymore (https://github.com/fastify/fastify-multipart using also this docs https://dev.to/sergey_telpuk/nestjs-fastify-multer-uploading-cropping-image-12b9 and https://medium.com/@427anuragsharma/upload-files-using-multipart-with-fastify-and-nestjs-3f74aafef331)
Hi @kamilmysliwiec, I just created a new nest project and in trying to use fastify without any options but I get this message
node_modules/@nestjs/platform-fastify/adapters/fastify-adapter.d.ts:50:5 - error TS2416: Property 'createMiddlewareFactory' in type 'FastifyAdapter
' is not assignable to the same property in base type 'AbstractHttpAdapter , FastifyReply >'.
Type '(requestMethod: RequestMethod) => Promise<(path: string, callback: Function) => any>' is not assignable to type '(requestMethod: RequestMethod) => (path: string, callback: Function) => any'.
Type 'Promise<(path: string, callback: Function) => any>' is not assignable to type '(path: string, callback: Function) => any'.
50 createMiddlewareFactory(requestMethod: RequestMethod): Promise<(path: string, callback: Function) => any>;
src/main.ts:11:5 - error TS2769: No overload matches this call.
Overload 1 of 2, '(module: any, options?: NestApplicationOptions): Promise', gave the following error.
Type 'FastifyAdapter' has no properties in common with type 'NestApplicationOptions'.
Overload 2 of 2, '(module: any, httpAdapter: AbstractHttpAdapter, options?: NestApplicationOptions): Promise', gave the following error.
Argument of type 'FastifyAdapter' is not assignable to parameter of type > 'AbstractHttpAdapter '.
The types returned by 'createMiddlewareFactory(...)' are incompatible between these types.
Type 'Promise<(path: string, callback: Function) => any>' is not assignable to type '(path: string, callback: Function) => any'.
Type 'Promise<(path: string, callback: Function) => any>' provides no match for the signature '(path: string, callback: Function): any'.
11 new FastifyAdapter(),
Found 2 error(s).
@newcoder171 make sure to keep @nestjs/core
, @nestjs/common
and @nestjs/platform-fastify
versions in sync (for example, 7.4.1)
@kamilmysliwiec thanks. everything works fine now
@kamilmysliwiec what version of apollo-server-fastify
works?
Most helpful comment
@newcoder171 make sure to keep
@nestjs/core
,@nestjs/common
and@nestjs/platform-fastify
versions in sync (for example, 7.4.1)