Skip to content

Parse-server and OkHttp #392

Closed
Closed
@jpmassena

Description

@jpmassena

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 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions