Skip to content
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

[PROPOSAL] Deprecate fully useMasterKey and Parse.User.currentUser() #2633

Closed
flovilmart opened this issue Sep 1, 2016 · 12 comments
Closed
Labels
type:feature New feature or improvement of existing feature
Milestone

Comments

@flovilmart
Copy link
Contributor

As those functions are misleading and unavailable in Cloud Code, I suggest we replace those implementations by implementations that would log a warning in the 1st place and throw an exception later on.

The warning could have a link to the CloudCode migration notes

@benishak
Copy link
Contributor

benishak commented Sep 1, 2016

why ? we still using Parse.Cloud.useMasterKey() and Parse.Cloud.HttpRequest and they are working fine, why deprecate them?

@bohemima
Copy link
Contributor

bohemima commented Sep 1, 2016

@benishak, Parse.Cloud.useMasterKey does not work and you should be sending the useMasterKey option in every individual save/find/etc options instead.

HttpRequest is not being deprecated afaik but you should consider using the "request" module instead now that you can use third party node modules.

@hramos
Copy link
Contributor

hramos commented Sep 1, 2016

Agree with this. IIRC, the current state is that people who port their Cloud Code over without consulting the migration notes may assume their code will continue working as-is as these methods fail silently.

@flovilmart flovilmart added this to the 2.3.0 milestone Sep 1, 2016
@flovilmart
Copy link
Contributor Author

flovilmart commented Sep 1, 2016

I've planned that for 2.3.0, to make it breaking/throw error in that case.

Do anyone have any voice to raise that those 2 functions will throw an exception starting 2.3.0

@benishak
Copy link
Contributor

benishak commented Sep 1, 2016

I'm not sure but because when we migrated we almost refactor the whole cloud code and when we were getting 'permission denied use Master Key' we solved it by calling Parse.Cloud.useMasterkey(). It worked almost everywhere except with Parse.Push.send we had to use { useMasterkey : true }

@flovilmart
Copy link
Contributor Author

flovilmart commented Sep 1, 2016

even a better reason to prevent the usage of Parse.Cloud.useMasterKey() as it may have horrible side effects with concurrent request... you should use {useMasterKey: true} everywhere you need it.

See: https://github.com/ParsePlatform/parse-server/wiki/Compatibility-with-Hosted-Parse#master-key-must-be-passed-explicitly

Maybe we haven't been explicit enough about that, an additional reason to enforce it strongly,

@benishak
Copy link
Contributor

I'm using now the latest version and have a class wich has CLP and ACL set to Master key only and have a defined Cloud function

Parse.Cloud.define('verifyemail', function(req, res) {
      Parse.Cloud.useMasterkey()
      ..
      ..
});

It stills working,

I also have another Cloud Function which calls Parse.Cloud.HttpRequest and is still working
How and why?

@flovilmart
Copy link
Contributor Author

flovilmart commented Oct 25, 2016

when you call Parse.Cloud.useMasterkey() that makes all future calls use the masterKey:

https://github.com/ParsePlatform/Parse-SDK-JS/blob/2956decbe54f2cf6d2c17ff1b4d8db98327410d6/src/Parse.js#L148

Basically, calling it once would probably make all future calls use the masterKey which is why we highly recommend you don't use Parse.Cloud.useMasterKey().

And I never mentioned anything about httpRequest, but Parse.User.current()

@cherukumilli
Copy link
Contributor

@flovilmart @hramos
Will the Parse JS SDK continue to support Parse.User.current()?
If not, is there a better way to retrieve the currently logged in ParseUser with a valid session, either from memory or localStorage on the client side.

@flovilmart
Copy link
Contributor Author

@cherukumilli yes in the client side SDK that's all good, not on the serverside though... (because of the concurrency and global state of ParseSDK)

@acinader
Copy link
Contributor

acinader commented Dec 7, 2016

i think this is a great idea that could be helpful to folks migrating (everyone's all done, right?).
👍

@flovilmart
Copy link
Contributor Author

It seems that Parse.User.current() should always return null anyway: https://github.com/ParsePlatform/Parse-SDK-JS/blob/2956decbe54f2cf6d2c17ff1b4d8db98327410d6/src/ParseUser.js#L26

@mtrezza mtrezza added type:feature New feature or improvement of existing feature and removed type:improvement labels Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

7 participants