Skip to content

Repo reproducing the error "Cannot read properties of undefined (reading 'header')" when implementing rate limiter with GraphQL as specified in documentation: https://docs.nestjs.com/security/rate-limiting#graphql

Notifications You must be signed in to change notification settings

nicostubi/nestjs-throttler-header-bug

Repository files navigation

Installation

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

To reproduce graphql request and nestjs throttling rate limiter error

# URL (POST)
http://localhost:3020/graphql

# QUERY
query ($_id: String!) {
    blog (
        _id: $_id
    ) {
        __typename
        _id
        description
        title
    }
}

# GRAPHQL VARIABLES
{
    "_id": "eu"
}

# Error received
{
    "errors": [
        {
            "message": "Cannot read properties of undefined (reading 'header')",
            "locations": [
                {
                    "line": 2,
                    "column": 5
                }
            ],
            "path": [
                "blog"
            ],
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR"
            }
        }
    ],
    "data": null
}

About

Repo reproducing the error "Cannot read properties of undefined (reading 'header')" when implementing rate limiter with GraphQL as specified in documentation: https://docs.nestjs.com/security/rate-limiting#graphql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published