Skip to content

Does parse-server call next() or not? #4085

@woodardj

Description

@woodardj

At the very beginning of its open source life, ParseServer was not calling next() to hand off execution to later middlewares — then (if my notes are correct), a change with version 2.2.16 ParseServer began calling next() after execution. We implemented a middleware directly after as a stopgap measure until we could properly deal with the fallthrough. But now it appears our middleware is not being called on requests that are Parse queries. Here's our setup:

    var api = new ParseServer({/*...*/});

    var mountPath = process.env.PARSE_MOUNT || "/parse";
    app.use(mountPath, api);

    app.use(function (req, res, next) {
        // !! NEVER EXECUTES WHEN PATH IS /parse/classes/<className> OR /parse/functions/<functionName>
        var path = req.path.split('/');
        var req_id = req.headers['x-request-id'];
        console.log(req_id + " checking parse-next() middleware through " + req.path ); 
        // ...
    });

Currently using ParseServer 2.4.2. We're hoping to set up some server-wide instrumentation, which would require executing middlewares after parse-server even on routes it handled.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions