amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

[Feature Request] Support ampx --output-version 1

Open hangoocn opened this issue 1 year ago • 11 comments

Hi just a follow up to this issue where we are required to add --outputs-versioin 0 to the ampx command.

I have created another react app using latest gen2 with version 1 outputs, and want to share the backend with the flutter app. So it will make it easy when both are on version 1.

May I know when it will support version 1 or is there any suggestion how to make both react and flutter app share same backend in amplify gen 2? Thanks!

hangoocn avatar May 06 '24 15:05 hangoocn

Hello @hangoocn - Support for the new format is in progress. We will let you know when it is available.

Jordan-Nelson avatar May 06 '24 16:05 Jordan-Nelson

Can I add to this. It would be nice if I could pass the json config directly to the Amplify.configure. i.e. drop the dart generation. The main reason for this for me right now is that the --outputs-format parameter is not available for 'ampx pipeline-deploy' , thus meaning you cannot currently use the amplify frontend deploy to deploy flutter frontends. As a workaround I have written a service that creates a conform config from the version 0 json (it is very fragile). So in general it would be great if with this update we could use the generated json as I see no need for the dart format option.

andrew-clark-dev avatar May 25 '24 15:05 andrew-clark-dev

@andrew-clark-dev can you explain what you mean by "pass the json config directly to the Amplify.configure"? The config file today is a .dart file with a json string. Are you looking for this file to be a .json file? Or are you looking for this to be a dart Map?

Jordan-Nelson avatar May 28 '24 14:05 Jordan-Nelson

Hi @Jordan-Nelson , what I would like to be able to do is ,

In the pubspec.yaml

  assets:
    - lib/amplifyconfiguration.json

and then in main

    final String config =
        await rootBundle.loadString('lib/amplifyconfiguration.json');

    await Amplify.configure(config);

i.e. not have to use the dart constant. The main reason I have for this is that currently I cannot provide the "-outputs-format dart" to the "ampx pipeline-deploy" command and so I cannot simply deploy my frontend via the Amplify pipeline.

andrew-clark-dev avatar May 31 '24 13:05 andrew-clark-dev

The main reason I have for this is that currently I cannot provide the "-outputs-format dart" to the "ampx pipeline-deploy" command

@andrew-clark-dev can you open a feature request for that here?

Jordan-Nelson avatar May 31 '24 14:05 Jordan-Nelson

what I would like to be able to do is ,

In the pubspec.yaml

assets:

  • lib/amplifyconfiguration.json

and then in main

final String config =
    await rootBundle.loadString('lib/amplifyconfiguration.json');

await Amplify.configure(config);

I believe this should be possible once the new format is supported. Once the new format is supported we will recommend generating and using the amplify_outputs.dart file, but I don't think there would be anything stopping you from generating the amplify_outputs.json file and then loading it like you have specified once Amplify Flutter supports the new format.

Jordan-Nelson avatar May 31 '24 14:05 Jordan-Nelson

Thanks, I will wait on the support for the new outputs config.

I currently have written a parser that create the flutter config from the amplify_outputs.json , of course it only supports the basic setup , but it's working for me. Where can I find the schema for the outputs json? Is there already a a dart object supporting fromJson for this file?

BTW: this would have been much easier if AuthConfig.cognito supported CognitoAppSyncConfig as an input param , I was surprised it did not generate the AppSync config for me (as it could from the parameters, I think) ;-)

andrew-clark-dev avatar Jun 01 '24 13:06 andrew-clark-dev

BTW: I have created the feature request.

https://github.com/aws-amplify/amplify-backend/issues/1595

So this issue can be closed from my point of view, but I am not talking for @hangoocn of course.

andrew-clark-dev avatar Jun 01 '24 13:06 andrew-clark-dev

@andrew-clark-dev Apologies, I may not have been clear. We are actively working on making changes in Amplify Flutter to support the new Amplify outputs format. We will continue to use this issue to track that work. When that is complete, you should be able to use lib/amplify_outputs.dart or assets/amplify_outputs.json (although we will continue to document and recommend using lib/amplify_outputs.dart). I think you can close https://github.com/aws-amplify/amplify-backend/issues/1595 since we will track support for amplify_outputs json/dart in this issue.

If you want to see support for ampx pipeline-deploy --outputs-format dart, that feature request should be opened in using the template I had linked above..

Let me know if you have any questions.

Jordan-Nelson avatar Jun 01 '24 17:06 Jordan-Nelson

My bad, new feature request here https://github.com/aws-amplify/amplify-backend/issues/1612

andrew-clark-dev avatar Jun 04 '24 17:06 andrew-clark-dev

Thanks @andrew-clark-dev

Jordan-Nelson avatar Jun 04 '24 19:06 Jordan-Nelson

closing this issue as it is released in Amplify Flutter 2.2.0.

NikaHsn avatar Jul 05 '24 17:07 NikaHsn