-
Notifications
You must be signed in to change notification settings - Fork 260
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
Reconfigure Amplify at runtime (call Amplify.configure()
multiple times)
#1902
Comments
@sagar14791 this is not currently possible so marked this as a feature request. |
@ragingsquirrel3 is there any workaround besides app restart? |
@ragingsquirrel3 Amplify.reset(); gives error |
Sorry for the confusion here. To clarify, runtime re-configuration is not currently supported in the underlying iOS/Android libraries. We are tracking this as a feature request here and will post further updates there. |
@dnys1 is this feature going to get added anytime soon? |
I am going to re-open this issue. This was closed as a duplicate of #1208. While there are similarities between the two requests, they do seem to be distinct. We will use this issue to track interest in the ability to re-configure Amplify at run time. That is, call Amplify.configure() multiple times. #1208 will be used to track interest in a new service which allows pulling any configuration data from a remote source. While this configuration data could be an Amplify config, it could also be any other data such as feature flags. |
Amplify.configure()
multiple times)
This feature is not currently on our roadmap. If you would like to see this supported, please comment with details about your use case. Thanks. |
I want to describe our use-case: |
@Jordan-Nelson Thank you for re-opening this issue
for Offline data Collection and storing data Offline, I am using the following Configuration.
now when I am online and collecting data all works fine, as soon as I enter data it goes to the datastore and gets synced to amplify, at the end of the day when they will reach the office or any time of the day they have access to the network, they should be able to Sync data
to Online
So basically, I should be able to change the configuration of Amplify on demand. it can be region based or just basic Configuration. |
@ragingsquirrel3 @dnys1 @Jordan-Nelson |
I'd like to describe our use case as well: Our app currently supports two countries. For each country, we have a different Amplify project with a different list of users. So one user can have two different accounts, one for each country. And we allow the user to dynamically change its current country through a feature inside the app. When that happens, we log the user out so they can log in again on the selected country context. But to allow the user to log in on the selected country, we'd need to re-configure the amplify sdk with the configurations for the selected country amplify project, which is currently not possible. (I'm also on version v0.6 because of some dependency conflicts, but we will probably migrate to v1 soon) |
Please consider adding a runtime amplify reconfiguration. My customers have different API endpoints, and in React + Apollo I can dynamically set those urls |
Hello everyone, thank you for all the feedback on needing this feature. We have it on our radar, and we will investigate how to enable this moving forward. We will provide an update when we have a path forward. |
Hello everyone, I have been interested in this function, especially my use case is to update the amplify configurations when any aws region presents a problem. Right now the solution I see is to force the app to close and have the user start it again. |
@abdallahshaban557 Any updates on this feature? |
To clarify my request....I need to modify the GQL/Appsync Endpoints based on claims made in Cognito user attributes. Otherwise a Flutter/Amplify app can only connect with an initial configuration. My clients who use my app have unique APIs, hence the problem with a static amplifyconfiguration.dart file. In an my React/Amplify app, I implement Apollo HttpLink within the client, which allows me to change the GQL URL at any time after the user has authenticated with Cognito. Thus, allowing me to modify user access based on their attributes post authentication. https://www.apollographql.com/docs/react/api/link/apollo-link-http/ However, React does not provide an easy, maintainable development path for mobile/tablet (and even desktop) like flutter does. Is there a roadmap to implement such a feature? |
Hello @richwcahill - thank you for sharing that use case. We understand this request, and have plans to enable the re-configuration of Amplify Flutter to accomplish this. We do not have an exact timeline right now - but we will share it on this issue when we do! |
My use case for the runtime configuration is to enable creating a silo multi-tenant app with one frontend. |
My use-case is a multi-tenant application as well. As a workaround, I'm experimenting with restarting the Flutter engine using the restart plugin.
This allows me to reconfigure amplify without triggering an @Jordan-Nelson do you think this could work? |
This is blocking us, in our mobile app, user can switch different countries and based on country they will go to different aws region...we can't use same aws region across countries for privacy and compliance reasons. Outside this, we also have a test app that connects to different environments that target different aws account and regions. At minimum, can Amplify.reset() method which currently is internal be made public so caller can reset and reconfigure? |
Hello @anankul, Amplify.reset() it is only supported for internal use within unit tests currently, but you can call it within your code by calling:
However some of our packages depend on Amplify iOS/Android SDKs which do not support multiple configurations, so I would not recommend using this in production code. If you can give the iOS/Android issues a thumbs up it will help us gauge interest in them. Unfortunately we are blocked on the Flutter side without a work around until these are implemented. Edit: I just noticed you have already replied to the iOS issue. |
Updated Request
The ability to call
Amplify.configure()
multiple times with new config values, or to use different config values based on region or other condition.Original Request
I want to configure amplify once for Online including AmplifyDataStore Plugin and AmplifyAPI Plugin and second once for offline only AmplifyDataStore Plugin.
How to remove configuration of amplify?
The text was updated successfully, but these errors were encountered: