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

"Hot restart" is causing a subsequent call to Amplify.configure #94

Closed
Rayv1 opened this issue Aug 31, 2020 · 5 comments
Closed

"Hot restart" is causing a subsequent call to Amplify.configure #94

Rayv1 opened this issue Aug 31, 2020 · 5 comments
Labels
core Issues related to the Amplify Core Plugin Documentation Improvements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes).

Comments

@Rayv1
Copy link

Rayv1 commented Aug 31, 2020

Describe the bug
PlatformException (PlatformException(AmplifyException, The client issued a subsequent call to Amplify.configure after the first had already succeeded., {cause: null, recoverySuggestion: Be sure to only call Amplify.configure once}))

To Reproduce
Steps to reproduce the behavior:

  Amplify amplify = Amplify();
  bool _isAmplifyConfigured = false;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _initAmplifyFlutter();
  }

  void _initAmplifyFlutter() async {
    print("init amplify");
    AmplifyAuthCognito auth = AmplifyAuthCognito();

    amplify.addPlugin(
      authPlugins: [auth],
    );
    // Initialize AmplifyFlutter
    await amplify.configure(amplifyconfig);

    setState(() {
      _isAmplifyConfigured = true;
    });
  }

Platform
Amplify Flutter current supports iOS and Android. This issue is reproducable in (check all that apply):
[x] Android
[] iOS (cant test)

Additional context
This Error happens in VSCode when hot restarting.

@fjnoyp
Copy link
Contributor

fjnoyp commented Aug 31, 2020

Hi @Rayv1 thanks for bringing this issue to our attention.

Our Amplify Flutter framework currently supports hot reloading but not hot restarting.

For now, we recommend hot reloading or stopping and starting the the app in VSCode. Please let us know if that would be a major problem for you and your workflow.

We will look into how we might fix this issue in the future.

@fjnoyp fjnoyp added core Issues related to the Amplify Core Plugin Documentation Improvements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes). labels Aug 31, 2020
@Rayv1
Copy link
Author

Rayv1 commented Sep 1, 2020

Hi @fjnoyp its okay for now. i just comment it out, when using hot restart.

@Rayv1 Rayv1 closed this as completed Sep 1, 2020
@lukaselmer
Copy link
Contributor

lukaselmer commented Sep 12, 2020

Hi @Rayv1 thanks for bringing this issue to our attention.

Our Amplify Flutter framework currently supports hot reloading but not hot restarting.

For now, we recommend hot reloading or stopping and starting the the app in VSCode. Please let us know if that would be a major problem for you and your workflow.

We will look into how we might fix this issue in the future.

Hi @fjnoyp,

This is a major problem for my workflow - not having the option to hot restart slows me down substantially.

What is the behavior if the app is already configured (in Kotlin / Android), and then the Dart VM is restarted? Do I have to configure it again, or will it work with the previous configuration? Would it be possible to add a separate method here to check if the configuration is initialized already? Why wouldn't we allow configuring it a second time, overwriting the previous configuration? 🤔

@bwhiteTP
Copy link

bwhiteTP commented Sep 24, 2020

@Rayv1 @fjnoyp Not sure why this was closed, this is a major problem for us, please reopen.

@Rayv1
Copy link
Author

Rayv1 commented Sep 25, 2020

I put it in a try catch Block, so iam still calling it, but when an error appears, iam doing nothing. The authentication Plugin ist ein still working with this work around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues related to the Amplify Core Plugin Documentation Improvements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes).
Projects
None yet
Development

No branches or pull requests

4 participants