All Versions
34
Latest Version
Avg Release Cycle
19 days
Latest Release
1213 days ago

Changelog History
Page 2

  • v3.2.1 Changes

    August 17, 2020

    ๐Ÿฑ ๐Ÿ“š PR:

    • โฌ†๏ธ Bump autocannon from 5.1.0 to 6.0.0
    • โšก๏ธ update(package.json): add rafaelgss as member (#2464)
    • We have a discord! (#2473)
    • ๐Ÿ“„ docs: what to do to became a collaborator (#2468)
    • โฑ increase timeout (#2477)
    • ๐Ÿ‘Œ support unWritable props in the logger option (#2474)
    • ๐Ÿ›  fix hasContentTypeParser to include native types (#2450)
    • โšก๏ธ Update Ecosystem.md (#2479)
    • โšก๏ธ Update Server.md (#2482)
    • ๐Ÿ›  fix: test slowness on windows (#2481)
    • ๐Ÿ›  fix: typings for hooks (#2485)
    • feat: delete non existent files references (#2491)
    • ci: avoid unnecessary runs (#2490)
    • doc: add discord badge (#2489)
    • โž• Adds new section that better explains ESM context and TypeScript exports (#2484)
    • โž• Add type commonjs (#2493)
    • โž• Adds support for plugin dynamic imports in TS projects (#2494)
    • โž• add PROJECT_CHARTER (#2045)
    • โœ‚ removed unused link (#2496)
  • v3.2.0 Changes

    August 06, 2020

    Features:

    • โž• Added validationError property to request - #2422
    • โž• add: route-level custom Error Handlers - #2427
    • โž• add routePath in onRoute hook - #2451
    • feat: add hook onTimeout - #2457

    ๐Ÿ›  Fixes:

    • ๐Ÿ›  fix schema lock in #2463

    ๐Ÿ“š Documentation:

    • โšก๏ธ Update Routes.md - #2424
    • ๐Ÿ›  Fix several broken links on website, clarify docs - #2434
    • ๐Ÿ‘Œ improve and expand docs around error handling - #2425
    • ๐Ÿ“„ docs: add logger option in async/await example - #2465

    TypeScript:

    • feat: make fastify() PromiseLike - #2428
    • typings: add getSchema and getSchemas - #2441
    • ๐Ÿ‘Œ Improve server types - #2449

    Internals:

    • ๐Ÿšš Move headers to be a getter on Request - #2426
    • ๐Ÿ”จ Refactor override - #2432
    • ๐Ÿ—„ Use fastify-warning for handling deprecation warnings #2354
  • v3.1.1 Changes

    July 17, 2020

    ๐Ÿฑ ๐Ÿ“š PR:

    • โœ‚ Removed warnings introduced in #2418 (#2419)
  • v3.1.0 Changes

    July 17, 2020

    ๐Ÿฑ ๐Ÿ“š PR:

    • ๐Ÿ“„ docs(readme): add my name and fix order (#2413)
    • reopened server show more detail error msg (#2415)
    • ๐Ÿšš Move ip, ips and hostname to getters in request (#2418)
  • v3.0.3 Changes

    July 15, 2020

    ๐Ÿฑ ๐Ÿ“š PR:

    • โšก๏ธ Update Server.md (#2407)
    • โž• Add missing type (#2400)
    • โฌ†๏ธ Bump avvio to 7.1.1 and add a regression test (#2408)
    • ๐Ÿ›  Fix ready return (#2410)
    • ๐Ÿšš Move cemremengu to past contributors (#2412)
    • โž• Add type for Reply payload (#2389)
  • v3.0.2 Changes

    July 11, 2020

    ๐Ÿฑ ๐Ÿ“š PR:

    • ๐Ÿ›  Fix a wrong TypeScript typing issue at register() function (#2401)
  • v3.0.1 Changes

    July 11, 2020

    ๐Ÿฑ ๐Ÿ“š PR:

    • โž• add .dependabot to .npmignore
    • โฌ†๏ธ Bump tsd from 0.11.0 to 0.12.0 (#2360)
    • feat(Serverless): Add netlify-lambda guide (#2359)
    • โšก๏ธ Update Errors.md (#2364)
    • ๐Ÿ›  fix test per security release (#2365)
    • โšก๏ธ Update Hooks.md (#2363)
    • ๐Ÿ“„ docs(Serverless): add missing netlify-lambda link (#2362)
    • โšก๏ธ updated docs/ecosystem to remove old Google Datastore package that we abandoned, removed fastify-firestore in favor of our new fastify-firebase all in one plugin. fastify-firebase includes firebase-admin SDK including auth, firestore, storage, machineLearning, and more (#2366)
    • โž• add fastify-prettier to ecosystem (#2370)
    • โฌ†๏ธ Bump tsd from 0.12.1 to 0.13.1 (#2375)
    • โšก๏ธ Update Hooks.md (#2371)
    • await app must resolve to the app (#2376)
    • Reorder generic parameter of FastifyRequest for ease of use (#2373)
    • โšก๏ธ Updated benchmarks (#2380)
    • ๐Ÿ›  Fix support for executing benchmark on Windows (#2322)
    • โฌ†๏ธ Bump fastify-plugin from 1.6.1 to 2.0.0 (#2384)
    • โšก๏ธ Updated LTS dates (#2383)
    • ๐Ÿ›  fix(typo) Correct typo: Alternativies to Alternatives (#2387)
    • ๐Ÿ›  Fix res.raw.statusCode typo (#2386)
    • ๐Ÿ“„ docs: Created a gentler intro to the .inject method and running tests with tap (#2369)
    • โž• add Promise version overload for FastifyPlugin (#2350)
  • v3.0.0 Changes

    July 08, 2020

    ๐Ÿ’ฅ Breaking changes

    โšก๏ธ โš ๏ธ When updating your application to Fastify v3, update all the module at once. There might be incompatibilities by trying to do them "one at a time".

    ๐Ÿ”„ Changed middleware support (#2014)

    ๐Ÿ‘ From Fastify v3, middleware support does not come out-of-the-box with the framework itself.

    ๐Ÿ”Œ If you use Express middleware in your application, please install and register the fastify-express plugin or middie plugin before doing so.

    v2:

    // Using the Express `cors` middleware in Fastify v2.fastify.use(require('cors')());
    

    v3:

    // Using the Express `cors` middleware in Fastify v3.await fastify.register(require('fastify-express'));fastify.use(require('cors')());
    

    ๐Ÿ”„ Changed logging serialization (#2017)

    โšก๏ธ The logging Serializers have been updated to Fastify Request and Reply objects instead of native ones.

    โšก๏ธ Any custom serializers must be updated if they rely upon request or reply properties that are present on the native objects but not the Fastify objects.

    v2:

    const fastify = require('fastify')({logger: {serializers: {res(res) {return {statusCode: res.statusCode,customProp: res.customProp};}}}});
    

    v3:

    const fastify = require('fastify')({logger: {serializers: {res(reply) {return {statusCode: reply.statusCode, // No change requiredcustomProp: reply.raw.customProp // Log custom property from res object};}}}});
    

    ๐Ÿ”„ Changed schema substitution (#2023)

    ๐Ÿšš The non-standard replace-way shared schema support has been removed. This feature has been replaced with JSON Schema specification compliant $ref based substitution. To better understand this change read Validation and Serialization in Fastify v3.

    v2:

    const schema = {body: 'schemaId#'};fastify.route({ method, url, schema, handler });
    

    v3:

    const schema = {body: {$ref: 'schemaId#'}};fastify.route({ method, url, schema, handler });
    

    ๐Ÿ”„ Changed schema validation options (#2023)

    ๐Ÿ‘ The setSchemaCompiler and setSchemaResolver options have been replaced with the setValidatorCompiler to enable future tooling improvements. To better understand this change read Validation and Serialization in Fastify v3.

    v2:

    const fastify = Fastify();const ajv = new AJV();ajv.addSchema(schemaA);ajv.addSchema(schemaB);fastify.setSchemaCompiler(schema =\> ajv.compile(schema));fastify.setSchemaResolver(ref =\> ajv.getSchema(ref).schema);
    

    v3:

    const fastify = Fastify();const ajv = new AJV();ajv.addSchema(schemaA);ajv.addSchema(schemaB);fastify.setValidatorCompiler(({ schema, method, url, httpPart }) =\>ajv.compile(schema));
    

    ๐Ÿ”„ Changed preParsing hook behaviour (#2286)

    ๐Ÿ›ฐ From Fastify v3, the behavior of the preParsing hook will change slightly in order to support request payload manipulation.

    ๐Ÿ›ฐ The hook now takes an additional argument, payload, and therefore the new hook signature is fn(request, reply, payload, done) or async fn(request, reply, payload).

    The hook can optionally return a new stream via done(null, stream) or returning the stream in case of async functions.

    If the hook returns a new stream, it will be used instead of the original one in following hooks. A sample use case for this is handling compressed requests.

    โšก๏ธ The new stream should add the receivedEncodedLength property to the stream that should reflect the actual data size received from the client. For instance, in a compressed request it should be the size of the compressed payload. This property can (and should) be dynamically updated during data events.

    ๐Ÿ—„ The old syntax of Fastify v2 without payload is supported but it is deprecated.

    ๐Ÿ”„ Changed hooks behaviour (#2004)

    ๐Ÿ‘ From Fastify v3, the behavior of onRoute and onRegister hooks will change slightly in order to support hook encapsulation.

    • onRoute - The hook will be called asynchronously. The hook is now inherited when registering a new plugin within the same encapsulation scope. Thus, this hook should be registered before registering any plugins.
    • ๐Ÿ”Œ onRegister - Same as the onRoute hook. The only difference is that now the very first call will no longer be the framework itself, but the first registered plugin.

    ๐Ÿ”„ Changed Content Type Parser syntax (#2286)

    ๐Ÿ“œ In Fastify v3 the content type parsers now have a single signature for parsers.

    ๐Ÿ›ฐ The new signatures are fn(request, payload, done) or async fn(request, payload). Note that request is now a fastify request, not an IncomingMessage. The payload is by default a stream. If the parseAs option is used in
    ๐Ÿ›ฐ addContentTypeParser, then payload reflects the option value (string or buffer).

    ๐Ÿ—„ The old signatures fn(req, [done]) or fn(req, payload, [done]) (where req is IncomingMessage) are still supported but are deprecated.

    ๐Ÿ”„ Changed TypeScript support

    0๏ธโƒฃ The type system was changed in Fastify version 3. The new type system introduces generic constraining and defaulting, plus a new way to define schema types such as a request body, querystring, and more!

    v2:

    interface PingQuerystring {foo?: number;}interface PingParams {bar?: string;}interface PingHeaders {a?: string;}interface PingBody {baz?: string;}server.get\<PingQuerystring, PingParams, PingHeaders, PingBody\>('/ping/:bar',opts,(request, reply) =\> {console.log(request.query); // This is of type `PingQuerystring`console.log(request.params); // This is of type `PingParams`console.log(request.headers); // This is of type `PingHeaders`console.log(request.body); // This is of type `PingBody`});
    

    v3:

    server.get\<{Querystring: PingQuerystring;Params: PingParams;Headers: PingHeaders;Body: PingBody;}\>('/ping/:bar', opts, async (request, reply) =\> {console.log(request.query); // This is of type `PingQuerystring`console.log(request.params); // This is of type `PingParams`console.log(request.headers); // This is of type `PingHeaders`console.log(request.body); // This is of type `PingBody`});
    

    ๐Ÿ‘ป Manage uncaught exception (#2073)

    ๐Ÿ”ง In sync route handlers, if an error was thrown the server crashed by design without calling the configured .setErrorHandler(). This has changed and now all unexpected errors in sync and async routes are managed.

    v2:

    fastify.setErrorHandler((error, request, reply) =\> {// this is NOT calledreply.send(error)})fastify.get('/', (request, reply) =\> {const maybeAnArray = request.body.something ? [] : 'I am a string'maybeAnArray.substr() // Thrown: [].substr is not a function and crash the server})
    

    v3:

    fastify.setErrorHandler((error, request, reply) =\> {// this IS calledreply.send(error)})fastify.get('/', (request, reply) =\> {const maybeAnArray = request.body.something ? [] : 'I am a string'maybeAnArray.substr() // Thrown: [].substr is not a function, but it is handled})
    

    Further additions and improvements

  • v3.0.0-rc.5 Changes

    June 29, 2020

    ๐Ÿฑ ๐Ÿ“š PR:

    • 0๏ธโƒฃ Disable allErrors in default Ajv config
    • โž• Add fastify-peekaboo plugin (#2330)
    • โšก๏ธ Update Errors.md (#2332)
    • feat: specify this context for setErrorHandler (#2338)
    • ๐Ÿ›  fix: add code to FastifyError typing (#2337)
    • ๐Ÿ›  fix ready order execution (#2333)
    • ๐Ÿ‘ Allow TS type augmentation for Fastify.prototype.use (#2335)
    • List fastify-tokenize on the ecosystem doc page (#2340)
    • โž• add fastify-raw-body to Ecosystem (#2342)
    • ๐Ÿ“ฆ Move createError utility to its own package (#2339)
    • โž• Add missing parameter done in example (#2353)
    • โž• add test to verify ND-JSON content is not serialized as JSON (#2349)
    • โšก๏ธ updated Getting-Started.md - added more detail making the process easier to understand (#2352)
  • v2.15.3 Changes

    August 06, 2020

    Fixes:

    • inject function return normal value with non-ready app - #2417