profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/fastify/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Fastify fastify http://fastify.io Fast and low overhead web framework, for Node.js

fastify/fastify 20900

Fast and low overhead web framework, for Node.js

fastify/fast-json-stringify 2438

2x faster than JSON.stringify()

fastify/benchmarks 390

Fast and low overhead web framework fastify benchmarks.

fastify/fastify-cli 333

Run a Fastify application with one command!

fastify/aws-lambda-fastify 248

Insipired by aws-serverless-express to work with Fastify with inject functionality.

fastify/avvio 222

Asynchronous bootstrapping of Node applications

fastify/docs-chinese 204

Fastify 中文文档

fastify/fastify-auth 191

Run multiple auth functions in Fastify

fastify/fastify-autoload 150

Require all plugins in a directory

fastify/fast-proxy 113

Node.js framework agnostic library that enables you to forward an http request to another HTTP server. Supported protocols: HTTP, HTTPS, HTTP2

issue commentfastify/fastify-swagger

Auth button doesn't work well with field defined in securityDefinitions and in schema headers

@mcollina Ran across this a few times recently and finally got annoyed enough to do something. See above.

JemarJones

comment created time in 2 hours

startedfastify/fastify-sensible

started time in 2 hours

startedfastify/fastify-express

started time in 2 hours

pull request commentfastify/fastify-express

Adds `secure` property to NodeJS Request (`req.raw`).

Could you please articulate why this is needed?

Sure. Our HTTP NodeJS server, that sits behind a HTTPS Load Balancer, failed to set the secure cookie on the response's header. When reviewing the express-session implementation, the function responsible for adding the header returns early if the request is deemed as "not secure". Now, when the trustProxy option for ExpressJS is not set to either true or false the check for whether or not the request is secure is based on req.secure === true.

Without this patch and enabling the trustProxy option on Fastify, the NodeJS HTTP server believes it is attempting to add a secure cookie via HTTP which is deemed as insecure even though it is behind an HTTPS Load Balancer.

TL:DR: An HTTP Server behind an HTTPS Load Balancer fails to add secure cookies to the response.

gannan08

comment created time in 2 hours

PR opened fastify/fastify-swagger

Ignore schema items when used and in security definitions

In theory, this resolves #196 .

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/fastify/fastify/blob/master/CONTRIBUTING.md

By making a contribution to this project, I certify that:

  • (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

  • (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

  • (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

  • (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

Checklist

+35 -16

0 comment

1 changed file

pr created time in 2 hours

startedfastify/fastify

started time in 2 hours

fork markrzen/fastify-swagger

Swagger documentation generator for Fastify

fork in 3 hours

PullRequestReviewEvent

startedfastify/fastify

started time in 4 hours

PR opened fastify/fastify-express

Adds `secure` property to NodeJS Request (`req.raw`).

Adds ExpressJS short-hand for: req.protocol === 'https' .

<!-- Thank you for your pull request. Please provide a description above and review the requirements below.

Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/fastify/fastify/blob/master/CONTRIBUTING.md

By making a contribution to this project, I certify that:

  • (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

  • (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

  • (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

  • (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. -->

Checklist

+12 -4

0 comment

2 changed files

pr created time in 4 hours

issue closedfastify/point-of-view

How to use the include directive in the esj file

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the issue has not already been raised

Issue

The readme file is a little odd to follow. It's confusing the include directive. In the readme file the example just mention putting this piece of code in the ejs file: <% include header.ejs %>. But that code doesn't work and the lib fails trying to parse it.

In my personal case, I have to search inside the examples in the repo to figure it out how to use it, at the end in some example appears in this way: <%- include("./braintree.ejs") %>. Not sure if the readme file can be enhanced with a more accurate description on how to include partial ejs files, and maybe include a link to the example file: templates/index-with-includes.ejs

Hope this can save time for other readers...

closed time in 4 hours

borodovisin

issue commentfastify/point-of-view

How to use the include directive in the esj file

Was fixed on this PR: https://github.com/fastify/point-of-view/pull/262

borodovisin

comment created time in 4 hours

push eventfastify/point-of-view

Arturo Riveron Borovisina

commit sha 0e7859d3d9aff7e4a5cb0291cfe394418a8dc016

Fix include logic using EJS templates (#262) * fix(readme): fix include logic using ejs templates * fix(readme): relative path to the template file Co-authored-by: Arturo Riveron Borodovisina <aborodovisina@paypal.com>

view details

push time in 4 hours

PR merged fastify/point-of-view

Fix include logic using EJS templates

This PR includes minor edits on the Readme file, related to EJS templates. It was a little confusing how to include a partial EJS file in an EJS template.

The example code was fixed. Also, a link with a file example on how to use the <%include%> in an EJS template was added.

+2 -2

0 comment

1 changed file

borodovisin

pr closed time in 4 hours

PullRequestReviewEvent

startedfastify/fastify

started time in 4 hours

issue commentfastify/fastify-cookie

Exported types doesn't includes parseCookie method for fastify instance

Would you like to send an PR to address the issue? Remember to add an unit test under test folder.

devlegacy

comment created time in 4 hours

Pull request review commentfastify/point-of-view

Fix include logic using EJS templates

 const resolve = require('path').resolve ``` and in ejs template files (for example templates/index.ejs) use something like: ```html-<% include header.ejs %>+<%- include('header.ejs') %> ```-with a path relative to the current page, or an absolute path.+with a path relative to the current page, or an absolute path. Please check this example [here](https://raw.githubusercontent.com/fastify/point-of-view/c7ff7775cbc8dcf1a7194a517efbf243a74bd0be/templates/layout-with-includes.ejs)

I don't think we should use the raw content with fixed version.

with a path relative to the current page, or an absolute path. Please check this example [here](./templates/layout-with-includes.ejs)
borodovisin

comment created time in 4 hours

PullRequestReviewEvent
PullRequestReviewEvent

issue commentfastify/fastify

middiePlugin error

This problem is resolved. nestjs require a fixed version of fastify. Please follow the documentation of nestjs for the other setup.

chenyulun

comment created time in 4 hours

issue closedfastify/fastify

middiePlugin error

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the bug has not already been reported

Fastify version

8.1.1

Plugin version

middie

Node.js version

16.x

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

3.10.0-957.el7.x86_64 #1 SMP Thu Oct 4 20:48:51 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Description

[root@xxxxxxxx pui-polyfill]# yarn start:prod
yarn run v1.22.17
$ cross-env NODE_ENV=production node dist/main
[Nest] 14887  - 10/22/2021, 7:30:09 PM     LOG [NestFactory] Starting Nest application...
[Nest] 14887  - 10/22/2021, 7:30:09 PM     LOG [InstanceLoader] AppModule dependencies initialized +55ms
/root/gitlab/pui-polyfill/node_modules/.pnpm/middie@5.3.0/node_modules/middie/index.js:21
      path = prefix + (path === '/' && prefix.length > 0 ? '' : path)
                                              ^

TypeError: Cannot read properties of undefined (reading 'length')
    at Object.use (/root/gitlab/pui-polyfill/node_modules/.pnpm/middie@5.3.0/node_modules/middie/index.js:21:47)
    at /root/gitlab/pui-polyfill/node_modules/.pnpm/@nestjs+platform-fastify@8.1.1_9569caea4829e1e6a54e03a46e955ce7/node_modules/@nestjs/platform-fastify/adapters/fastify-adapter.js:224:27
    at MiddlewareModule.registerHandler (/root/gitlab/pui-polyfill/node_modules/.pnpm/@nestjs+core@8.1.1_fd2a30749d40d79b96b1254a3e96f533/node_modules/@nestjs/core/middleware/middleware-module.js:153:9)
error Command failed with exit code 1.

Steps to Reproduce

➜  pui-polyfill git:(feat) yarn build
yarn run v1.22.15
$ rimraf dist
$ nest build
✨  Done in 5.80s.
➜  pui-polyfill git:(feat) yarn start:prod
yarn run v1.22.15
$ cross-env NODE_ENV=production node dist/main
[Nest] 29024  - 2021/10/22 下午7:47:25     LOG [NestFactory] Starting Nest application...
[Nest] 29024  - 2021/10/22 下午7:47:25     LOG [InstanceLoader] AppModule dependencies initialized +52ms
/Users/chenyulun390/gitlab/pui-polyfill/node_modules/.pnpm/registry.npmmirror.com+middie@5.3.0/node_modules/middie/index.js:21
      path = prefix + (path === '/' && prefix.length > 0 ? '' : path)
                                              ^

TypeError: Cannot read property 'length' of undefined
    at Object.use (/Users/chenyulun390/gitlab/pui-polyfill/node_modules/.pnpm/registry.npmmirror.com+middie@5.3.0/node_modules/middie/index.js:21:47)
    at /Users/chenyulun390/gitlab/pui-polyfill/node_modules/.pnpm/registry.npmmirror.com+@nestjs+platform-fastify@8.1.1_9569caea4829e1e6a54e03a46e955ce7/node_modules/@nestjs/platform-fastify/adapters/fastify-adapter.js:224:27
    at MiddlewareModule.registerHandler (/Users/chenyulun390/gitlab/pui-polyfill/node_modules/.pnpm/registry.npmmirror.com+@nestjs+core@8.1.1_fd2a30749d40d79b96b1254a3e96f533/node_modules/@nestjs/core/middleware/middleware-module.js:153:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
➜  pui-polyfill git:(feat) 

Expected Behavior

It worked two days ago, but not today Did you change some code to cause it?

closed time in 4 hours

chenyulun

issue openedfastify/fastify-cookie

Exported types doesn't includes parseCookie method for fastify instance

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the bug has not already been reported

Fastify version

3.22.1

Plugin version

5.3.1

Node.js version

16.11.1

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

10

Description

The parseCookie is not include in the .d.ts file. This causes that when using the method through the fastify instance, a typing error is generated even though the method does exist in the instances.

Steps to Reproduce

import fastifyCookie from 'fastify-cookie' // { FastifyCookieOptions }
import fp from 'fastify-plugin'
import fastifySession from 'fastify-session'

export default fp<any>(async (fastify, opts) => {
  fastify.register(fastifyCookie)
  fastify.register(fastifySession, {
    secret: String(process.env.APP_KEY),
    saveUninitialized: false,
    cookie: {
      httpOnly: true,
      secure: process.env.NODE_ENV !== 'production'
    }
  })

  // TS Error: Property 'parseCookie' does not exist on type 'FastifyInstance<Server, IncomingMessage, ServerResponse, FastifyLoggerInstance>'.ts(2339)
  fastify.parseCookie('cookie')
})

Expected Behavior

I did a little fix, creating the typing in the creation of a plugin, for example. But I think it is something that should be included in the .dt.s

import fastifyCookie from 'fastify-cookie' // { FastifyCookieOptions }
import fp from 'fastify-plugin'
import fastifySession from 'fastify-session'

export default fp<any>(async (fastify, opts) => {
  fastify.register(fastifyCookie)
  fastify.register(fastifySession, {
    secret: String(process.env.APP_KEY),
    saveUninitialized: false,
    cookie: {
      httpOnly: true,
      secure: process.env.NODE_ENV !== 'production'
    }
  })

  fastify.parseCookie('cookie')
})

declare module 'fastify' {
  export interface FastifyInstance {
    parseCookie(cookieHeader: string): Record<string, any>
  }
}

created time in 6 hours

startedfastify/fastify

started time in 7 hours

startedfastify/fastify-csrf

started time in 7 hours

startedfastify/fastify-etag

started time in 7 hours

startedfastify/fastify

started time in 8 hours

PR opened fastify/point-of-view

Fix include logic using EJS templates

This PR includes minor edits on the Readme file, related to EJS templates. It was a little confusing how to include a partial EJS file in an EJS template.

The example code was fixed. Also, a link with a file example on how to use the <%include%> in an EJS template was added.

+2 -2

0 comment

1 changed file

pr created time in 8 hours

fork borodovisin/point-of-view

Template rendering plugin for Fastify

fork in 8 hours

issue commentfastify/point-of-view

How to use the include directive in the esj file

Hi @mcollina, sure, I'll create a PR for this one, sorry for the delay I was a little busy.

borodovisin

comment created time in 8 hours