-
Notifications
You must be signed in to change notification settings - Fork 243
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
Push Notification Configuration fails (on Android only) when multiple API endpoints are present #5423
Comments
Rolling back to version 2.1.0 prevents issue, but is far from ideal. Need to understand why AmplifyOutputs contains the following:
and
|
Failing a change to AmplifyOutputs, perhaps the following should be modified to use a custom JSON encoder to prevent the incompatibility for now:
Line 238 in 6aaf966
and
Line 35 in 6aaf966
|
Sorry that you are facing this issue and thanks for reporting it. We will look into this and get back to you when we have updates. |
@bitsplash-andy The Amplify CLI (both Generations 1 and 2) does not support multiple GraphQL API endpoints. Hence, the Amplify Flutter libraries are designed to handle configurations with only one GraphQL API endpoint. While the AmplifyOutputs type allows for multiple data endpoints, this is primarily for internal implementations and backwards compatibility. When using custom pipeline for deployment please make sure the amplify configuration is a valid josn for this schema. |
Hi @NikaHsn, thanks for your reply. To clarify, we don’t use the Amplify CLI, everything is provisioned manually via CDK etc. We only use the client library. The client library has supported multiple API endpoints without issue up until version 2.2.0, at which point this began failing in the push notification library as described above. for example the following :
can be switched at runtime via
or
Multiple API endpoint calls continue to work as expected if the push notifications plugin is disabled, but the enforced single endpoint schema on configuration serialisation described above causes the push notification plugin to throw an exception on initialisation if multiple API endpoints are present. As the configuration cannot be specified on a plugin basis, this means that the choice appears to be stay on version 2.1.0 or loose the ability to enable the push notifications plugin in newer releases. Additionally, this only happens on Android. From a library consumption perspective for users that want to use existing, non-Amplify provisioned backends this is a real issue. |
Apologies, I've updated my previous comment a few times for clarity. |
thanks @bitsplash-andy for clarification. we will look into this and get back to you when we have update. |
Description
I am unable to configure push notifications on Android using version 2.4.1 of all plugins when having two GraphQL APIs defined in the config. All functionality works as expected on iOS.
It looks as though the push notifications code has been updated to use Gen2 Amplify Outputs via: #5073
There is a conditional platform statement on line 233 which encodes the config for storage in the SecureStorage.
amplify-flutter/packages/notifications/push/amplify_push_notifications/lib/src/amplify_push_notifications_impl.dart
Line 233 in 6aaf966
This causes the following exception to be thrown
The cause of this is:
https://github.com/aws-amplify/amplify-flutter/blob/6aaf966e7907cba71b9d2cf6f84ae2dc6e4d50b0/packages/amplify_core/lib/src/config/amplify_outputs/amplify_outputs.dart#L111C1-L125C2
As I say, this breaks Push Notifications on Android only when the API config contains more than one endpoint. All other categories function as expected if the Push Notification plugin is removed, and there are no issues on iOS even when plugin is present.
I'm assuming more things may break further down the line as the Gen2 code is adopted into more packages, but it's frustrating to have such an edge case appear after migrating the codebase to the latest version.
Categories
Steps to Reproduce
Add more then one API endpoint to the configuration
add
AmplifyPushNotificationsPinpoint()
viaAmplify.addPlugins
call
Amplify.configure
Screenshots
No response
Platforms
Flutter Version
3.24.1
Amplify Flutter Version
2.4.1
Deployment Method
Custom Pipeline
Schema
No response
The text was updated successfully, but these errors were encountered: