Closed
Description
Issue Description
I'm attempting to log request payloads for monitoring reasons and it seems that everytime I use the bodyParser.text() in my express server (I'm logging Parse JS SDK calls, and it appears that only the bodyParser.text places the payload in req.body), the parse-server is not able to use the rest of the request.
When bodyParser.text() is in place, all requests respond with:
ParseError {code: undefined, message: "unauthorized"}
Do you know why this is the case?
app.use(bodyParser.text());
app.use('/parse/classes/:className/:id?', function (req, res, next) {
var params = req.params;
var className = params.className;
var objectId = params.id;
var originalURL = req.originalUrl;
if (objectId && !seenParseModifyClassRules.className) {
nr.addNamingRule('^\/parse\/classes\/' + className + '\/.+', 'Create|Modify/' + className);
console.log(req.body);
seenParseModifyClassRules[className] = true;
} else if (!objectId && !seenParseGeneralClassRules.className) {
nr.addNamingRule('^\/parse\/classes\/' + className + '$', 'Query|General/' + className);
console.log(req.body);
seenParseGeneralClassRules[className] = true;
}
next();
});
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
Steps to reproduce
On the JS side, I merely use a call with the following code:
const userQuery = new Parse.Query('_User');
userQuery.contains('firstName', 'Tom');
userQuery.find().then((asdf) => {
console.log(asdf);
}, (error) => {
console.log(error);
});
Expected Results
I expect the Parse-Server to console log the request payload, and the response to return the Parse Query.
Actual Outcome
Parse-Server logs the request payload, but Parse Query is responded with "unauthorized"
Environment Setup
- Server
- parse-server version (Be specific! Don't say 'latest'.) : ^2.7.4
- Operating System: Windows 10
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Local
Metadata
Metadata
Assignees
Labels
No labels