Skip to content

Can't set headers after they are sent after 2.2.17 upgrade #2520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cspnanda opened this issue Aug 15, 2016 · 2 comments
Closed

Can't set headers after they are sent after 2.2.17 upgrade #2520

cspnanda opened this issue Aug 15, 2016 · 2 comments

Comments

@cspnanda
Copy link

Issue Description

  • Deployed Parse Server 2.2.17 on Heroku.
  • Using iOS SDK. I set in a Parse Object and save it as

[pfObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { }]

In the heroku logs I see

Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:346:11)
at /app/node_modules/express/lib/application.js:153:9
at /app/node_modules/express/lib/router/index.js:137:5
at /app/node_modules/express/lib/router/index.js:250:10
at next (/app/node_modules/express/lib/router/index.js:160:14)
at next (/app/node_modules/express/lib/router/index.js:176:38)
at Immediate. (/app/node_modules/express/lib/application.js:190:9)
at Immediate. (/app/node_modules/parse-server/node_modules/express/lib/router/index.js:618:15)
at Immediate.immediate._onImmediate (timers.js:572:18)
at tryOnImmediate (timers.js:534:15)

This was not happening before.

@maziyarpanahi
Copy link

#2362

@woodardj
Copy link

A touch hacky, but we included something like this immediately after mounting the parse-server middleware:

app.use(function (req, res, next) {
    var path = req.path.split('/');
    if (path[1] === 'parse') {
        return;
    }
    return next();
});

This let us move forward with fixing the rest of our bugs while halting requests to the parse API that we weren't expecting to flow through (as was the case on Parse.com), and we can fix the rest of our app to expect this more standard Express behavior later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants