Non-functionnal API versioning with Fastify + MediaType
See original GitHub issueBug Report
Current behavior
Fastify
If I configure to use Fastify-platform, the server initialize without any problem, but does not start nor open the listening socket, even if the callback at api.listen returns a value.
[Nest] 35105 - 08/15/2021, 12:22:04 PM LOG [NestFactory] Starting Nest application...
[Nest] 35105 - 08/15/2021, 12:22:04 PM LOG [InstanceLoader] AppModule dependencies initialized +38ms
[Nest] 35105 - 08/15/2021, 12:22:04 PM LOG [RoutesResolver] AppController {/}: +7ms
[Nest] 35105 - 08/15/2021, 12:22:04 PM LOG [RouterExplorer] Mapped {/, GET} (version: 1) route +3ms
[Nest] 35105 - 08/15/2021, 12:22:04 PM LOG [RouterExplorer] Mapped {/, GET} (version: 2) route +0ms
[Nest] 35105 - 08/15/2021, 12:22:04 PM LOG [NestApplication] Nest application successfully started +3ms
Displayed: Running at http://127.0.0.1:3000/
<<< END OF THE INPUT
The server never open the listening socket
Express
This is working with Express-platform.
[Nest] 35139 - 08/15/2021, 12:23:25 PM LOG [NestFactory] Starting Nest application...
[Nest] 35139 - 08/15/2021, 12:23:25 PM LOG [InstanceLoader] AppModule dependencies initialized +35ms
[Nest] 35139 - 08/15/2021, 12:23:25 PM LOG [RoutesResolver] AppController {/}: +7ms
[Nest] 35139 - 08/15/2021, 12:23:25 PM LOG [RouterExplorer] Mapped {/, GET} (version: 1) route +4ms
[Nest] 35139 - 08/15/2021, 12:23:25 PM LOG [RouterExplorer] Mapped {/, GET} (version: 2) route +1ms
[Nest] 35139 - 08/15/2021, 12:23:25 PM LOG [NestApplication] Nest application successfully started +2ms
Displayed: Running at http://127.0.0.1:3000/
Not displayed: Running at http://[::1]:3000
<<< END OF THE INPUT
Input Code
I made a simple POC to illustrate the problem:
https://github.com/lolo32/poc-nest-swagger-versioning-error/tree/error-fastify
Expected behavior
Using Fastify must works like Express does.
Environment
_ _ _ ___ _____ _____ _ _____
| \ | | | | |_ |/ ___|/ __ \| | |_ _|
| \| | ___ ___ | |_ | |\ `--. | / \/| | | |
| . ` | / _ \/ __|| __| | | `--. \| | | | | |
| |\ || __/\__ \| |_ /\__/ //\__/ /| \__/\| |_____| |_
\_| \_/ \___||___/ \__|\____/ \____/ \____/\_____/\___/
[System Information]
OS Version : macOS Catalina
NodeJS Version : v14.17.4
NPM Version : 7.20.5
[Nest CLI]
Nest CLI Version : 8.1.1
[Nest Platform Information]
platform-express version : 8.0.6
platform-fastify version : 8.0.6
schematics version : 8.0.2
testing version : 8.0.6
common version : 8.0.6
core version : 8.0.6
cli version : 8.1.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Nestjs versioning configuration when using Fastify
For performance reasons of a relatively complex Nestjs application, we have chosen to use Fastify as our HTTP provider.
Read more >fastify-api - npm
A radically simple API routing and method injection library for Fastify. Latest version: 0.2.0, last published: 2 years ago.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
my bad. I didn’t notice the versioning
And this bug appears due do that, I’ve tested
Thanks for your research @micalevisk! I’ve created a Draft PR here https://github.com/nestjs/nest/pull/7874 let’s move the discussion there