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

AmplifyPushNotificationsPinpoint doesn't support offline configuration #4688

Open
3 tasks done
wcoder opened this issue Apr 10, 2024 · 3 comments
Open
3 tasks done

AmplifyPushNotificationsPinpoint doesn't support offline configuration #4688

wcoder opened this issue Apr 10, 2024 · 3 comments
Assignees
Labels
bug Something is not working; the issue has reproducible steps and has been reproduced pending-release Issues that have been addressed in main but have not been released push notifications

Comments

@wcoder
Copy link

wcoder commented Apr 10, 2024

Description

AmplifyPushNotificationsPinpoint doesn't support offline configuration, so in this case, Amplify can't be configured at all (See steps).

Actual behavior:

PushNotificationException {
  "message": "Error occurred awaiting for device token to register device with Pinpoint",
  "recoverySuggestion": "Please review the underlying exception",
  "underlyingException": "NetworkException {\n  \"message\": \"The request failed due to a network error.\",\n  \"recoverySuggestion\": \"Ensure that you have an active network connection\",\n  \"underlyingException\": \"POST https://cognito-identity.eu-central-1.amazonaws.com/? failed: SocketException: Failed host lookup: 'cognito-identity.eu-central-1.amazonaws.com' (OS Error: No address associated with hostname, errno = 7)\"\n}"
}

#0      AmplifyPushNotifications._registerDevice (package:amplify_push_notifications/src/amplify_push_notifications_impl.dart:403:7)
<asynchronous suspension>
#1      AmplifyPushNotifications._registerDeviceWhenConfigure (package:amplify_push_notifications/src/amplify_push_notifications_impl.dart:348:7)
<asynchronous suspension>
#2      AmplifyPushNotifications.configure (package:amplify_push_notifications/src/amplify_push_notifications_impl.dart:231:5)
<asynchronous suspension>
#3      Future.wait.<anonymous closure> (dart:async/future.dart:518:21)
<asynchronous suspension>
#4      AmplifyClass._configurePlugins (package:amplify_core/src/amplify_class.dart:171:7)
<asynchronous suspension>
#5      AmplifyClass.configure (package:amplify_core/src/amplify_class.dart:128:7)
<asynchronous suspension>

Categories

  • Notifications (Push)

Steps to Reproduce

  1. Disable internet
  2. Launch a mobile app
  3. Configure Amplify in main():
await Amplify.addPlugins([
  AmplifyAuthCognito(),
  AmplifyPushNotificationsPinpoint(),
]);
await Amplify.configure(config.amplify);

runApp(...)

Expected

The Pinpoint plugin will send the device token, etc. when connected to the internet.

Actual

Unconfigured Amplify and no way to continue working with this.
Why did you do it this way? This request is not critical, send the device token as fire-and-forget and log errors, then in the listener send it again when it has been updated.

Also as you can see:

await _registerDeviceWhenConfigure();
_attachEventChannelListeners();

Exception in _registerDeviceWhenConfigure blocks all next steps:

  • SDK can't subscribe
  • SDK can't be reconfigured

Screenshots

No response

Platforms

  • iOS
  • Android

Flutter Version

3.19.4

Amplify Flutter Version

1.7.0

Deployment Method

Amplify CLI

Schema

No response

@Equartey Equartey added pending-triage This issue is in the backlog of issues to triage push notifications labels Apr 10, 2024
@Equartey
Copy link
Contributor

Hi @wcoder, thanks for taking the time to raise this issue. We willl investigate how to better support offline configuring of push notifications.

Can you provide more context for the use case this would unblock you from?

@wcoder
Copy link
Author

wcoder commented Apr 20, 2024

@Equartey use case is simple:

  1. Imagine an application that can work without the internet but using Amplify sometimes
  2. The user doesn't have internet access.
  3. For some reason, the app was restarted (due to a phone reboot or another issue).
  4. The app cannot configure Amplify at launch because the Pinpoint plugin blocks everything.

@khatruong2009 khatruong2009 added the bug Something is not working; the issue has reproducible steps and has been reproduced label Apr 25, 2024
@Jordan-Nelson Jordan-Nelson removed the pending-triage This issue is in the backlog of issues to triage label Apr 30, 2024
@Jordan-Nelson
Copy link
Contributor

@wcoder thanks for the info. We have labeled this as bug and will let you know when we have an update on a fix.

@NikaHsn NikaHsn added the pending-release Issues that have been addressed in main but have not been released label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working; the issue has reproducible steps and has been reproduced pending-release Issues that have been addressed in main but have not been released push notifications
Projects
None yet
Development

No branches or pull requests

5 participants