-
-
Notifications
You must be signed in to change notification settings - Fork 227
Description
Version
2.26
Platform
iOS
Swift Version
6.2.1
What happened?
Observed a transient server error (when the JWT access time was set to 31 seconds, for testing) in the refreshToken task.
This error was of type -1017 (cannot parse response).
As soon as this error is received, because it does not conform to any of the retry-able error codes defined in Sources/Helpers/RetryableError.swift, the session is immediately removed and the user is logged out.
Since this is a transient network-related error, this error should conform to the RetryableError protocol.
Steps to Reproduce
Unclear how exactly to reproduce this since this is a server-side error.
All I can say is that we kept the JWT expiry time to the minimum of 31 seconds so that we could test how the refreshTask work with expired tokens in the background since our users were complaining about getting logged out frequently.
Code Sample
Relevant log output
`18:40:03.043 |ERROR| [LoggerInterceptor.swift:44] intercept(_:next:) - Response: Failure Error Domain=NSURLErrorDomain Code=-1017 "cannot parse response" UserInfo={_kCFStreamErrorCodeKey=-1, NSUnderlyingError=0x158d557a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1017 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x123246c60 [0x2068fa4f0]>{length = 16, capacity = 16, bytes = 0x100201bbac4095f60000000000000000}, _kCFStreamErrorCodeKey=-1, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <7B28428D-48DA-4EB8-8D04-19051BF13EE8>.<791>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <7B28428D-48DA-4EB8-8D04-19051BF13EE8>.<791>"
), NSLocalizedDescription=cannot parse response, NSErrorFailingURLStringKey=https://gxeggqzppgbvswhfhsfy.supabase.co/auth/v1/token?grant_type=refresh_token, NSErrorFailingURLKey=https://gxeggqzppgbvswhfhsfy.supabase.co/auth/v1/token?grant_type=refresh_token, _kCFStreamErrorDomainKey=4}
18:40:03.045 |DEBUG| [SessionManager.swift:101] refreshSession(_:) - Refresh token failed with error: Error Domain=NSURLErrorDomain Code=-1017 "cannot parse response" UserInfo={_kCFStreamErrorCodeKey=-1, NSUnderlyingError=0x158d557a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1017 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x123246c60 [0x2068fa4f0]>{length = 16, capacity = 16, bytes = 0x100201bbac4095f60000000000000000}, _kCFStreamErrorCodeKey=-1, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <7B28428D-48DA-4EB8-8D04-19051BF13EE8>.<791>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <7B28428D-48DA-4EB8-8D04-19051BF13EE8>.<791>"
), NSLocalizedDescription=cannot parse response, NSErrorFailingURLStringKey=https://gxeggqzppgbvswhfhsfy.supabase.co/auth/v1/token?grant_type=refresh_token, NSErrorFailingURLKey=https://gxeggqzppgbvswhfhsfy.supabase.co/auth/v1/token?grant_type=refresh_token, _kCFStreamErrorDomainKey=4}`
## Subsequent calls to access the session result in |
18:40:03.316 |ERROR| [SessionStorage.swift:59] live(clientID:) - Failed to retrieve session: errSecItemNotFound: The item cannot be found.
18:40:03.319 |ERROR| [SessionStorage.swift:59] live(clientID:) - Failed to retrieve session: errSecItemNotFound: The item cannot be found.
18:40:03.319 |DEBUG| [SessionManager.swift:47] session() - session missing
18:40:03.322 |DEBUG| [SessionManager.swift:45] session() - error: sessionMissing
18:40:03.323 |ERROR| [SessionStorage.swift:59] live(clientID:) - Failed to retrieve session: errSecItemNotFound: The item cannot be found.
18:40:03.326 |ERROR| [SessionStorage.swift:59] live(clientID:) - Failed to retrieve session: errSecItemNotFound: The item cannot be found.
18:40:03.326 |DEBUG| [SessionManager.swift:47] session() - session missing
18:40:03.326 |DEBUG| [SessionManager.swift:45] session() - error: sessionMissing
18:40:03.326 |ERROR| [SessionStorage.swift:59] live(clientID:) - Failed to retrieve session: errSecItemNotFound: The item cannot be found.
18:40:03.328 |ERROR| [SessionStorage.swift:59] live(clientID:) - Failed to retrieve session: errSecItemNotFound: The item cannot be found.
18:40:03.328 |ERROR| [SessionStorage.swift:59] live(clientID:) - Failed to retrieve session: errSecItemNotFound: The item cannot be found.
18:40:03.328 |DEBUG| [SessionManager.swift:47] session() - session missing
18:40:03.328 |DEBUG| [SessionManager.swift:45] session() - error: sessionMissing
18:40:03.329 |ERROR| [SessionStorage.swift:59] live(clientID:) - Failed to retrieve session: errSecItemNotFound: The item cannot be found.