Skip to content

Parse decoding error at ParseAuthentication linkCommand when sessionToken is missing from response #108

@funkenstrahlen

Description

@funkenstrahlen

I see a parse JsonDecoder error:

ParseError code=-1 error=Error decoding parse-server response: Optional(<NSHTTPURLResponse: 0x6000006e84c0> { URL: https://podlive-parse-server.herokuapp.com/parse/users/jXjF1qjJhw } { Status Code: 200, Headers {
    "Access-Control-Allow-Headers" =     (
        "X-Parse-Master-Key, X-Parse-REST-API-Key, X-Parse-Javascript-Key, X-Parse-Application-Id, X-Parse-Client-Version, X-Parse-Session-Token, X-Requested-With, X-Parse-Revocable-Session, X-Parse-Request-Id, Content-Type, Pragma, Cache-Control"
    );
    "Access-Control-Allow-Methods" =     (
        "GET,PUT,POST,DELETE,OPTIONS"
    );
    "Access-Control-Allow-Origin" =     (
        "*"
    );
    "Access-Control-Expose-Headers" =     (
        "X-Parse-Job-Status-Id, X-Parse-Push-Status-Id"
    );
    Connection =     (
        "keep-alive"
    );
    "Content-Length" =     (
        40
    );
    "Content-Type" =     (
        "application/json; charset=utf-8"
    );
    Date =     (
        "Thu, 01 Apr 2021 13:24:07 GMT"
    );
    Etag =     (
        "W/\"28-69gFBc5Q54gsdpFK0tjSk36K+Xc\""
    );
    Server =     (
        Cowboy
    );
    Via =     (
        "1.1 vegur"
    );
    "X-Powered-By" =     (
        Express
    );
} }) with error: Die Daten konnten nicht gelesen werden, da sie fehlen. Format: Optional("{\"updatedAt\":\"2021-04-01T13:24:07.647Z\"}")

It says data can not be read because its missing.

I tracked it down to this location in ParseSwift code:

let user = try ParseCoding.jsonDecoder().decode(UpdateSessionTokenResponse.self, from: data)

The data object received from the server looks like this:

"{\"updatedAt\":\"2021-04-01T13:25:40.915Z\"}"

However ParseSwift expects this format:

internal struct UpdateSessionTokenResponse: Decodable {
    var updatedAt: Date
    let sessionToken: String
}

The sessionToken is missing.

This might be caused by using authentication wrong in my code. However I think a missing session token in the response should be handled explicitly by ParseSwift at this code location instead of just throwing an bad response format error.

What do you think?

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