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

Decoding error when loading amplify credentials: KeychainStoreError #3937

Closed
andr3a88-amk opened this issue Dec 11, 2024 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@andr3a88-amk
Copy link

Describe the bug

Hi, I've updated Amplify Swift from 2.43.0 to 2.45.1. When I run my app with the updated of Amplify I cannot fetch the access token (causing a force logout to the user). I fetch the access token calling cognitoTokenProvider.getCognitoTokens().get()

From Xcode console i noticed this log:

Error when loading amplify credentials: KeychainStoreError: Error occurred while decoding AWSCredentials
Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't.
Issue encountered at:
file: /Users/user/Library/Developer/Xcode/DerivedData/xxxxx/SourcePackages/checkouts/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift
function: recoverySuggestion
line: 90
Caused by:

typeMismatch(Swift.Dictionary<Swift.String, Any>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "userPoolOnly", intValue: nil), UserPoolOnlyCodingKeys(stringValue: "signedInData", intValue: nil), CodingKeys(stringValue: "signInMethod", intValue: nil), CodingKeys(stringValue: "apiBased", intValue: nil), ApiBasedCodingKeys(stringValue: "_0", intValue: nil)], debugDescription: "Expected to decode Dictionary<String, Any> but found a string instead.", underlyingError: nil))

Steps To Reproduce

Steps to reproduce the behavior:
1. Start the app with the updated version of Amplify Swift (2.45.1)
2. Request the token via `cognitoTokenProvider.getCognitoTokens().get()`
3. Got the error

Expected behavior

A valid access token should be returned

Amplify Framework Version

2.45.1

Amplify Categories

Auth

Dependency manager

Swift PM

Swift version

5.10

CLI version

12.12.6

Xcode version

Xcode 16.1 Build version 16B40

Relevant log output

<details>
<summary>Log Messages</summary>


INSERT LOG MESSAGES HERE
```

Is this a regression?

No

Regression additional context

No response

Platforms

No response

OS Version

18.1

Device

Simulator and real device (iPhone 15)

Specific to simulators

NO

Additional context

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Dec 11, 2024
@harsh62
Copy link
Member

harsh62 commented Dec 11, 2024

@andr3a88-amk Would you be able to share the entire verbose log? If possible, would you also be able to share the verbose logs when it was working in the earlier version.

Also did the config change from 2.43.0 to 2.45.1?

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Dec 11, 2024
@harsh62
Copy link
Member

harsh62 commented Dec 11, 2024

@andr3a88-amk I am able to reproduce the issue. I am working on a fix and will update as soon as I have a fix ready.

@harsh62 harsh62 added bug Something isn't working and removed pending-triage Issue is pending triage labels Dec 11, 2024
@harsh62
Copy link
Member

harsh62 commented Dec 11, 2024

A fix has been released for the issue. https://github.com/aws-amplify/amplify-swift/releases/tag/2.45.2

@andr3a88-amk
Copy link
Author

andr3a88-amk commented Dec 12, 2024

@harsh62 I can confirm that the issue is no longer present on 2.45.2

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Dec 12, 2024
@harsh62 harsh62 closed this as completed Dec 12, 2024
@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Dec 12, 2024
Copy link
Contributor

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants