aws-amplify / amplify-cli-export-construct

Apache License 2.0
11 stars 16 forks source link

Support for CDK v2? #28

Closed berenddeboer closed 2 years ago

berenddeboer commented 2 years ago

I noticed this was only CDK v1, any plans to upgrade to v2?

dannybpw commented 2 years ago

👍

bastiankistner commented 2 years ago

out of curiosity I'm trying to upgrade here https://github.com/passionkind/amplify-cli-export-construct/commit/4b079c26cc8abde8eed42568bb9408a554c9628f

seems that also this projen library went through several changes and it has to adapted... don't know if it'll work. I'll continue tomorrow probably. At least it doesn't look too bad atm

dannybpw commented 2 years ago

@passionkind - will keep an eye out on this 👍

@ammarkarachi @siegerts - If this issue could get a bit of loving would be amazing! bit unfortunate that this fairly new utility is only usable on "legacy" CDK

bastiankistner commented 2 years ago

so I managed to link the upgraded lib into one of my projects but I'm seeing the following error

CdkStack/amplifyBackend/amplifyBackend-amplify-backend-stack/AmplifyCfnInclude/AuthTriggerCustomLambdaStack [AWS::CloudFormation::Stack] is missing required property: templateUrl

When I check the root-stack-template.json with cfn-lint, it complains about a missing TemplateURL. So I assume that either

Figuring out the reason for it is a bit overwhelming at the moment as I just started to play with cdk / amplify for less than a week in the context of a side project.

I'll put it down for today.

Anyways there's also the publishJobs in the projenrc.js file that needs to be re-enabled

// TODO: re-enable integration test needs
// const projectRelease = release.Release.of(project);

// const publishJobs = project.release.publisher.jobs;
// Object.keys(project.release.publisher.jobs).forEach((r) => {
//   publishJobs[r].needs = ["integration_tests"];
// });

and I haven't yet been able to fully test the build process as I don't have maven installed or prepared any other language besides js/ts on my machine yet.

I also wonder how formatting is being handled at aws for this lib. Could find a prettier file so I created one that mostly resembles the previous standards.

However, I'm learning a lot here.

artyom-melnikov commented 2 years ago

Support of the CDK v2 is very much needed

artyom-melnikov commented 2 years ago

Ok I've migrated this library to the CDK v2, however, only the typescript part (didn't want to spend time on resolving jsii issues)

Here is the PR in my fork: https://github.com/artyom-melnikov/amplify-cli-export-construct/pull/1 This is the package: https://github.com/artyom-melnikov/amplify-cli-export-construct/packages/1369036

Usage (you should also configure npmrc to fetch package from github):

  "dependencies": {
    "aws-cdk": "^2.15.0",
    "aws-cdk-lib": "^2.15.0",
    "constructs": "^10.0.0",
    "@aws-cdk/aws-appsync-alpha": "^2.15.0-alpha.0",
    "@artyom-melnikov/cdk-exported-backend": "^1.0.0"
  }

Tested it with my amplify app and it worked. I do not plan to fix the issues there though, hopefully this package will be updated soon

ammarkarachi commented 2 years ago

@artyom-melnikov that's great wwork if you could open a PR for that I could take look

artyom-melnikov commented 2 years ago

@artyom-melnikov that's great wwork if you could open a PR for that I could take look

Sure: https://github.com/aws-amplify/amplify-cli-export-construct/pull/39

sobolk commented 2 years ago

We shipped new beta release 0.0.6 with CDK v2 support.