We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I updated to the latest version and now my cloud code function returns unauthorized. It was fine before the update.
Parse.Cloud.define('getUserRole', function(req, res) { var adminRoleQuery = new Parse.Query(Parse.Role); adminRoleQuery.equalTo('users', req.user); adminRoleQuery.first().then(function(result){ console.log(result); res.success(result.getName()); }, function(err){ res.error(err); }); })
This function should return the role of the user that is making the request.
The function returns unauthorized.
var api = new ParseServer({ databaseURI: process.env.DB_URL, verifyUserEmail: process.env.VERIFY_EMAIL, publicServerURL: process.env.EMAIL_URL , appName: process.env.APP_NAME , enableAnonymousUsers: false, mountPath: "/", emailAdapter: sesServer, cloud: process.env.CLOUD_CODE , appId: process.env.APP_ID, fileKey: process.env.FILE_KEY, filesAdapter:s3Adapter, masterKey: process.env.MASTER_KEY, clientKey: process.env.CLIENT_KEY, restAPIKey: process.env.REST_KEY, javascriptKey: process.env.JS_KEY, dotNetKey: process.env.DOT_NET_KEY || null, serverURL: process.env.CC_SERVER_URL, push: pushObj });
The server is running locally or remote and the database is hosted in a remote location.
error: Failed running cloud function getUserRole for user 86B4NyZpye with: Input: {} Error: {"code":141,"message":{"message":"unauthorized"}} functionName=getUserRole, code=141, code=undefined, message=unauthorized, , user=86B4NyZpye error: Error generating response. ParseError { code: 141, message: ParseError { code: undefined, message: 'unauthorized' } } code=141, code=undefined, message=unauthorized error: ParseError { code: undefined, message: 'unauthorized' } code=141, code=undefined, message=unauthorized Got Request
The text was updated successfully, but these errors were encountered:
fixed by using master key in First()
Sorry, something went wrong.
No branches or pull requests
Issue Description
I updated to the latest version and now my cloud code function returns unauthorized. It was fine before the update.
Steps to reproduce
Expected Results
This function should return the role of the user that is making the request.
Actual Outcome
The function returns unauthorized.
Environment Setup
The server is running locally or remote and the database is hosted in a remote location.
Logs/Trace
The text was updated successfully, but these errors were encountered: