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

Parse-server and OkHttp #392

Closed
jpmassena opened this issue Feb 7, 2016 · 5 comments
Closed

Parse-server and OkHttp #392

jpmassena opened this issue Feb 7, 2016 · 5 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@jpmassena
Copy link

I'm using Android SDK version 1.13 with a parse-server running on node.

From what I've been reading, the clients keys aren't needed with a "custom" parse-server, so I didn't include one when initializing Parse in my app.

If I add OkHttp dependency to my app, all requests to the server gives the following error:

java.lang.IllegalArgumentException: value == null
at com.squareup.okhttp.Headers$Builder.add(Headers.java:246)
at com.parse.ParseOkHttpClient.getRequest(ParseOkHttpClient.java:140)
at com.parse.ParseOkHttpClient.executeInternal(ParseOkHttpClient.java:66)
at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:158)
at com.parse.ParsePlugins$1.intercept(ParsePlugins.java:115)
at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:147)
at com.parse.ParseHttpClient.execute(ParseHttpClient.java:122)
at com.parse.ParseRequest$3.then(ParseRequest.java:136)
at com.parse.ParseRequest$3.then(ParseRequest.java:133)

If I debug the code, the cause is that there's an header being passed as null (X-Parse-Client-Key) and OkHttp doesn't like it, throwing an Exception at

com.squareup.okhttp.Headers$Builder.add(Headers.java:246)

If I initialize Parse with an empty String for the clientKey, this problem goes away.

Now, with OkHttp dependency, if I try to save a ParseFile, I get the following error:

com.parse.ParseRequest$ParseRequestException: Invalid file upload.
at com.parse.ParseRequest.newPermanentException(ParseRequest.java:270)
at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:301)
at com.parse.ParseRequest$3.then(ParseRequest.java:137)
at com.parse.ParseRequest$3.then(ParseRequest.java:133)
at bolts.Task$15.run(Task.java:917)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:908)

As soon as I remove the dependency, the file is uploaded correctly.

For the first issue, I guess it would be nice to check for that value being null and only send it on the request headers if it has a value.

The second one, I have no idea what's going on.

It seems someone already figured out the second issue on PR #364.

Wainting for a new release 👍

@jpmassena
Copy link
Author

Any news on this?

@grantland
Copy link
Contributor

For now you can pass in an empty string ("") as a workaround .

@grantland grantland added type:bug Impaired feature or lacking behavior that is likely assumed help wanted labels Feb 16, 2016
@jpmassena
Copy link
Author

Well, I'm doing that for the first issue.

The problem is I can't upload files if I have okhttp in my project....

@grantland
Copy link
Contributor

That seems to be part of the second issue, so it would be best to follow up with that in the pending PR.

@grantland
Copy link
Contributor

Merging into #402

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

2 participants