Skip to content

Bug Report: Cannot set property query of #<IncomingMessage> error when using express-mongo-sanitize #202

@amir-mansoor

Description

@amir-mansoor

When adding the express-mongo-sanitize middleware to my Express.js application, I encounter the following error:
Cannot set property query of # which has only a getter
This error appears on every screen/request after applying the middleware.
i install the middleware:
npm install express-mongo-sanitize

add it to the express app

import express from 'express';
import mongoSanitize from 'express-mongo-sanitize';

const app = express();
app.use(mongoSanitize());```

Expected Behavior:
The middleware should sanitize req.body, req.query, and req.params without throwing an error.

Current Behavior:
It throws the some error on every request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions