-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(amplify): Add missing Framework
and Platform
Cfn properties to Amplify
#23818
feat(amplify): Add missing Framework
and Platform
Cfn properties to Amplify
#23818
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! I have one question inline.
|
||
```ts | ||
const amplifyApp = new amplify.App(this, 'MyApp', { | ||
framework: 'ExampleFramework', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is any value here valid or are there specific frameworks that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review Kendra! This is a question I've also been struggling to find the answer to -- the CloudFormation documentation has no information on what the framework property actually is and whether or not there are specific values that work (same with the Amplify Docs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did the integ test successfully deploy with framework: TestFramework
? If so, I think we can say any value is valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaizencc Yes it did. Since I was able to successfully deploy with test: TestFramework
it seems that this property can take in an arbitrary string, so there is not a list of specific frameworks that are valid; if this was the case, we would implement the property as an enum
instead of a string
@TheRealAmazonKendra
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploying with an arbitrary value doesn't always mean the service will work correctly once deployed. Give me a day or two to check with the service team on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaizencc @TheRealAmazonKendra After speaking with Amplify, we learned that the framework
property is indeed meant to be an open text field where the user can enter any value (Amplify just ignores it if it does not recognize the framework).
However, we will also have to add a platform
property in the amplify.App
construct to solve the original problem from this issue - see the updated comments on the Github issue here for full context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I've been doing a deep dive on this module because it's on our list to stabilize and it seems that the frameworks can't actually be any value. The template might deploy, but the branch won't deploy within the app. We should discover what the combinations of platforms and frameworks are valid and update the contract accordingly. This may require a much larger set of changes that you intended to take on here, though.
Feel free to hit me up and chat about this. If it does require sweeping and/or breaking changes, I might just accept this change for the moment so that we unblock customers on this, even if I will end up altering the contract.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, the testing comments stand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, PM here from the Amplify team. I can confirm that the framework
property in that it is an open text field for any value. The detection around how to deploy the application happens based on the platform
property. WEB
is for SPAs or HTML based applications and WEB_COMPUTE
is for Next.js SSR only, at the moment.
Personally, I would approve this framework example test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be an open text but if we know that specific values work and only work in certain cases, we can make the contract reflect that so there's less room for error.
Framework
property to BranchOptions
Construct
Framework
property to BranchOptions
ConstructFramework
Cfn property to BranchOptions
Framework
Cfn property to BranchOptions
Framework
and Platform
Cfn properties to Amplify
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
}); | ||
|
||
amplifyApp.addCustomRule({ | ||
source: '/source', | ||
target: '/target', | ||
}); | ||
|
||
const mainBranch = amplifyApp.addBranch('main'); | ||
const mainBranch = amplifyApp.addBranch('main', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be its own test, not just an update to a current test. Also, we should be using the new IntegTest
construct for all new or edited test cases. I'd like to see an assertion added to the new test to ensure that it actually successfully deploys as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, this needs to be a separate IntegTest
.
@@ -442,3 +442,19 @@ test('with custom headers', () => { | |||
}, | |||
}); | |||
}); | |||
|
|||
test('create an amplify app with platform ', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This single test doesn't cover all the updates. Please increase the test coverage on your changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheRealAmazonKendra Hi, Amplify PM here, I think this test might cover the change made to the platform
updates applied at the Amplify App level. The framework
property tests are done in the branch.test.ts
.
This is the minimum test I had in my PR for the same functionality for this construct.
|
||
```ts | ||
const amplifyApp = new amplify.App(this, 'MyApp', { | ||
framework: 'ExampleFramework', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I've been doing a deep dive on this module because it's on our list to stabilize and it seems that the frameworks can't actually be any value. The template might deploy, but the branch won't deploy within the app. We should discover what the combinations of platforms and frameworks are valid and update the contract accordingly. This may require a much larger set of changes that you intended to take on here, though.
Feel free to hit me up and chat about this. If it does require sweeping and/or breaking changes, I might just accept this change for the moment so that we unblock customers on this, even if I will end up altering the contract.
|
||
```ts | ||
const amplifyApp = new amplify.App(this, 'MyApp', { | ||
framework: 'ExampleFramework', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, the testing comments stand.
👋 Hi @TheRealAmazonKendra @sumupitchayan @kaizencc Amplify PM here and author of a similar PR (#24078) until this more thorough PR was brought to my attention. I have made a few clarifications in PR comments but wanted to centralize here. I can confirm:
@TheRealAmazonKendra Per your comment #23818 (comment), I can confirm that there are not any combinations of platforms and frameworks to validate. As further validation of this PR and anecdotal evidence of the value of this PR from my perspective, and that of @michrome, the Amplify Hosting PM on a project to deploy Amplify apps using multiple platforms via the CDK, this PR accurately creates the CloudFormation necessary to deploy the apps in the correct manner. That said, I do agree there should be an integration test added to further validate, then this PR would be ready to merge. |
|
||
```ts | ||
const amplifyApp = new amplify.App(this, 'MyApp', { | ||
framework: 'ExampleFramework', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be an open text but if we know that specific values work and only work in certain cases, we can make the contract reflect that so there's less room for error.
We often write a tighter contract than the CloudFormation resources to improve the user experience. In playing around with this construct and with the Cfn resources, I found that, yes, you can put anything in |
Any action on this? Notice it's been 3 weeks with no commits or comments and this is a feature I'd love to see added to the CDK to be able to use the "web compute" platform more easily |
Closing due to in-progress redesign. |
This PR closes #23325 which requests adding the missing
Framework
CloudFormation property to BranchOptions in Amplify.fixes #24076
All Submissions:
Adding new Construct Runtime Dependencies:
New Features
yarn integ
to deploy the infrastructure and generate the snapshot (i.e.yarn integ
without--dry-run
)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license