Skip to main content

Character Limit

Limit number of characters in a GraphQL query document.

This help preventing DoS attacks by limiting the size of the document.

Out of core

This plugin is not part of the core package, you need to install it separately.


# npm
npm install

# yarn
yarn add


With @envelop/core from @the-guild-org

import { envelop } from '@envelop/core';
import { characterLimitPlugin } from '';

const getEnveloped = envelop({
plugins: [
// ... other plugins ...
maxLength: 15000, // Number of characters allowed | Default: 15000

Design decisions

This plugin relies on a parser plugin to works and access query document through the context.

This plugin is not part of the core package as your engine may provide such feature.

This plugin does not limit the size of input variables.