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

Exported Amplify backend is not fully building in Cdk deployment #12350

Open
2 tasks done
PadraicPairceir opened this issue Mar 30, 2023 · 11 comments · May be fixed by aws-amplify/amplify-cli-export-construct#61
Open
2 tasks done
Labels
export Issues related to cdk-exported-backend feature-request Request a new feature p3

Comments

@PadraicPairceir
Copy link

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v16.19.1

Amplify CLI Version

11.0.3

What operating system are you using?

Amazon Linux 2 (running in docker on Ubuntu WSL2)

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Describe the bug

In /app03/amp, using amplify init, I generated a new amplify backend for dev env. I generated the backend for flutter, so the amplifyconfiguration.dart file etc was generated. I see 2 IAM roles, 1 S3 bucket, with 3 files (1 zip, 3 json files), 1 cloudformation stack, and the generated backend project in amplify console.

In /app03/cdkapp, I generated a new cdk project with cdk init app --language=typescript --generate-only.

I export the backend using amplify export --out ../cdkapp/lib.

I delete the existing backend using amplify delete.

I update the cdk project to generate the exported amplify backend. I run cdk deploy.

I see 2 IAM roles, 1 S3 bucket (empty), 1 cloudformation stack. I see no project in the amplify console.

Expected behavior

To have the same number of files in the associated S3 bucket which is generated, and to see the project generated in the amplify console.

Reproduction steps

  1. cd /app03
  2. mkdir amp
  3. mkdir cdkapp
  4. cd amp
  5. amplify init
  • Choose access token access
  • Input token values
  • Choose app type "flutter"
  1. cd ../cdkapp
  2. cdk init app --language=typescript --generate-only
  3. npm i
  4. cdk bootstrap
  5. cd ..\amp
  6. amplify export --out ../cdkapp/lib
  7. amplify delete
  8. cd ..\cdkapp
  9. npm i @aws-amplify/cdk-exported-backend
  10. npm i lodash
  11. Update bin/cdkapp.ts to have content
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import { AmplifyExportedBackend } from '@aws-amplify/cdk-exported-backend'
import * as path from 'path' // To resolve the path to your exported Amplify backend assets

const app = new cdk.App();

const amplifyBackend = new AmplifyExportedBackend(app, "amplifyExportedBackend", {
  amplifyEnvironment: "dev", // Specify your Amplify environment
  path: path.resolve(__dirname, '../lib/amplify-export-app04')
})
  1. cdk deploy

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@PadraicPairceir PadraicPairceir added the pending-triage Issue is pending triage label Mar 30, 2023
@ykethan
Copy link
Member

ykethan commented Mar 31, 2023

Hey @PadraicPairceir , I was able to reproduce the issue. making as bug. The CDK appears to be creating the backend resources but not the Amplify project on console.

@ykethan ykethan added bug Something isn't working extensibility Issues related to expand or customize current configuration and removed pending-triage Issue is pending triage labels Mar 31, 2023
@ykethan ykethan removed their assignment Mar 31, 2023
@PadraicPairceir
Copy link
Author

@ykethan Great, thanks for the update.

@mmitchan
Copy link

mmitchan commented Apr 2, 2023

I'm looking forward to this update as well, thank you! Will it be possible to associate a frontend app with the exported backend using the same CDK stack? I'd like to use something like this after the backend is ready:

const amplifyApp = new amplify.App(this, 'amplifyapp', {
      sourceCodeProvider: new amplify.CodeCommitSourceCodeProvider({
        repository: repo,
      }),
      customRules: [
        {
          source:
            '</^[^.]+$|.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json|webp)$)([^.]+$)/>',
          target: '/index.html',
          status: amplify.RedirectStatus.REWRITE,
        },
      ],
      environmentVariables: {
        REGION: this.region,
      },
    });

    amplifyApp.addBranch('main');
    amplifyApp.addBranch('dev');

@PadraicPairceir
Copy link
Author

@mmitchan Yes, I'll need to consider this also. My other problem is how to get the generated config file (amplifyconfiguration.dart in the flutter case), to point to the cdk generated resource details.

@mmitchan
Copy link

mmitchan commented Apr 3, 2023

Ok. If you have any questions about my use case please let me know, I'm happy share if helps push this through.

@josefaidt josefaidt assigned josefaidt and unassigned josefaidt Apr 4, 2023
@josefaidt josefaidt added feature-request Request a new feature p3 and removed bug Something isn't working labels Apr 4, 2023
@josefaidt
Copy link
Contributor

Hey folks, we've reclassified this issue as a feature-request to improve this experience when we export an Amplify project to connect to a new/existing Amplify project

@mmitchan
Copy link

mmitchan commented Apr 4, 2023

Thank you for the update.

@ykethan ykethan added export Issues related to cdk-exported-backend and removed extensibility Issues related to expand or customize current configuration labels Apr 12, 2023
@ghost
Copy link

ghost commented Jul 5, 2023

Hello. is there any update to this?

@nickyshankar
Copy link

nickyshankar commented Nov 14, 2023

Any updates on this ? this is holding back our adoption of amplify

@richardokonicha
Copy link

hello guys any update on this.
Bumping this up.

@bolasater
Copy link

me too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
export Issues related to cdk-exported-backend feature-request Request a new feature p3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants