Skip to content

Application crashes when performing GET with limit = -1 and when the table contains a large number of items #172

Description

@ldechamps

Describe the Bug

When performing a GET request on a table containing a large number of items and specifying a limit of -1 (meaning no limit), the application unexpectedly exits.

To prevent the application from loading more data than the system can handle, it would be useful to introduce an environment variable —such as MAX_FETCH_LIMIT— to define the maximum allowed limit value for both GET and POST operations.
If a request exceeds this configured maximum, the application should return a clear error instead of crashing.

Important: This new limit must not affect operations such as aggregate[countDistinct], which should continue to work normally without being constrained by this maximum limit.

To Reproduce

Prepare a table containing a very large number of items (e.g., several hundred thousand or more) with related table
Perform a GET request on this table with the parameter limit = -1 : GET /my-table?limit=-1
Notice that the application exits unexpectedly (crashes) during the request

Directus Version

v9.10.3.15

Hosting Strategy

Self-Hosted (Docker Image)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions