Skip to content

Broke StoredSession JSON backward-compatibility #292

@leoMehlig

Description

@leoMehlig

Bug report

I noticed, that after upgrading to 2.5.0, I was logged out with the following error while retrieving the existing session:

keyNotFound(CodingKeys(stringValue: "identityId", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "session", intValue: nil), CodingKeys(stringValue: "user", intValue: nil), CodingKeys(stringValue: "identities", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "No value associated with key CodingKeys(stringValue: \"identityId\", intValue: nil) (\"identityId\").", underlyingError: nil))

After digging through recent changes, I believe the changes in #274 have caused this issue. A new value identityId was added to the UserIdentifiy without providing a fallback for stored sessions.

Describe the bug

The user gets logged out with the error above in the logs.

To Reproduce

  • Log in while using an older version
  • Upgrade to the latest release
  • Run app again
    -> User is logged out

Expected behavior

There is some sort of backwards-compatibility between releases.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: iOS
  • Version of supabase-swift: 2.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions