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

Generates a javascriptKey if not passed for CloudCode #652

Merged
merged 1 commit into from
Feb 26, 2016

Conversation

flovilmart
Copy link
Contributor

Proposed fix for #651 #356

@flovilmart flovilmart force-pushed the flovilmart.fixCloudCodeQueryProblem branch from bf0d892 to 98c6506 Compare February 25, 2016 19:15
@facebook-github-bot
Copy link

@flovilmart updated the pull request.

@gfosco
Copy link
Contributor

gfosco commented Feb 25, 2016

I'm not sure why this fixes it? It looks like they are issues with not providing a serverURL...

@flovilmart
Copy link
Contributor Author

@simonbengtsson
Copy link
Contributor

I can confirm that this fixes the issue, at least what is discussed in 356.

drew-gross added a commit that referenced this pull request Feb 26, 2016
…ryProblem

Generates a javascriptKey if not passed for CloudCode
@drew-gross drew-gross merged commit 839f6b7 into master Feb 26, 2016
@@ -79,7 +80,7 @@ function ParseServer({
cloud,
collectionPrefix = '',
clientKey = '',
javascriptKey = '',
javascriptKey = randomString(20),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to cause a problem. If any client key is set (clientKey, javascriptKey, restAPIKey, dotNetKey) then all requests to the server must use a valid client key... What was the actual issue, something with the SDK initialization?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was that when you omit the javascriptKey the parse SDK gets initialized wig an '' and doesn't like it when communicating with cloud code. If a user don't pass a JS key, the it means he doesn't want to use the JS SDK, so I init it to a random string. Actually, because it's init as an empty string, all the JS calls would have failed already as it would expect a javascriptKey header to be set to something empty and not undefined.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to fix this a different way, like passing an unused key to the SDK. We can't require client keys, and this change will do that..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's not ideal, but the cloud code SDK breaks when no JS key is set, we could throw if JS key is not set and .cloud is set

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm suggesting #680...

@simonbengtsson
Copy link
Contributor

Another related issue #654

@flovilmart flovilmart deleted the flovilmart.fixCloudCodeQueryProblem branch March 4, 2016 23:07
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

Successfully merging this pull request may close these issues.

5 participants