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

Amplify.API.subscribe fail after background back #3914

Open
smediomike opened this issue Nov 8, 2024 · 2 comments
Open

Amplify.API.subscribe fail after background back #3914

smediomike opened this issue Nov 8, 2024 · 2 comments
Labels
api Issues related to the API category bug Something isn't working pending-community-response Issue is pending response from the issue requestor

Comments

@smediomike
Copy link

Describe the bug

Application can not create subscribe once application go to background and then foreground. this issue did not happen on 2.17.1 and 2.26.1 SDK

Steps To Reproduce

1, start application 
2, create Amplify.API.subscribe(request: .subscription(of: BroadcastMessage.self, type: .onUpdate))
3, when all initialized, go to background
4, wait for one 20 seconds
5, go to foreground
6, Subscription has terminated will happen 
   do {
                for try await subscriptionEvent in messagesubscription {
   } catch {
                print("Subscription has terminated with \(error)")
   } 

7, after checked network status and subscribe status and restart this subscribe again
8, fail and can not create this subscribe again

Expected behavior

same to 2.26.1, application go to foreground, still can use subscribe or can create subscribe.

Amplify Framework Version

2.43.0

Amplify Categories

API, DataStore

Dependency manager

Swift PM

Swift version

5.0

CLI version

12.1.1

Xcode version

xcode16

Relevant log output

DataStoreIncomingAsyncSubscriptionEventPublisher] [InitializeSubscription.1] API.subscribe failed for `Document` error: WebSocketClient connection aborted\
Subscription has terminated with APIError: WebSocketClient connection aborted\
Recovery suggestion: WebSocketClient connection aborted\
Caused by:\
Error Domain=NSURLErrorDomain Code=-1005 "(null)"\

Is this a regression?

Yes

Regression additional context

2.17.1 and 2.26.1 are okay. our QA did such test, but 2.43.0 are always failed. 100% reproduce rate.

Platforms

iOS

OS Version

16.7/17.1/18.0

Device

iPhoneX/iPhone12/iPadPro

Specific to simulators

No response

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 Nov 8, 2024
@mattcreaser
Copy link
Member

Thanks for this report @smediomike - we will need to investigate.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 8, 2024
@mattcreaser mattcreaser added bug Something isn't working api Issues related to the API category and removed pending-triage Issue is pending triage labels Nov 8, 2024
@harsh62
Copy link
Member

harsh62 commented Nov 27, 2024

@smediomike Would you be able to share clear reproduction steps as am unable to reproduce the issue.

  • Do you perform any cancellations or subscriptions when app is going to background and foreground? If so, can you share the code snippet?
  • Are you able to reproduce this in a local isolated environment, if so, would you be able to share a demo app?
  • Would you be able to share your schema?
  • Can you share the entire verbose logs when the issue is happening?
  • Are you able to reproduce this on Simulator or it only happens on the device?

@harsh62 harsh62 added the pending-community-response Issue is pending response from the issue requestor label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to the API category bug Something isn't working pending-community-response Issue is pending response from the issue requestor
Projects
None yet
Development

No branches or pull requests

3 participants