Skip to content

fix(appsync): resolver unable to set pipelineConfig #9093

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

Merged
merged 10 commits into from
Jul 24, 2020

Conversation

BryanPan342
Copy link
Contributor

@BryanPan342 BryanPan342 commented Jul 16, 2020

[ISSUE]
pipelineConfig was be labeled as undefined while using the Resolver class instead of createResolver. Also, no way to set kind parameter for resolvers, so implemented that as well.

[APPROACH]
Created a property that takes pipelineConfig for AppSync functions.

[NOTE]
pipelineConfig takes a string array for the name of AppSync Functions not Lambda Functions

Fixes #6923

BREAKING CHANGE: pipelineConfig is now an array of string instead of CfnResolver.PipelineConfigProperty for usability.

  • appsync: pipelineConfig parameter takes in string []

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@mergify
Copy link
Contributor

mergify bot commented Jul 16, 2020

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@BryanPan342 BryanPan342 self-assigned this Jul 16, 2020
@BryanPan342 BryanPan342 added the @aws-cdk/aws-appsync Related to AWS AppSync label Jul 16, 2020
@BryanPan342 BryanPan342 changed the title bug(appsync): tentative changes that prevent fail with pipelineConfig fix(appsync): tentative changes that prevent fail with pipelineConfig Jul 16, 2020
MrArnoldPalmer
MrArnoldPalmer previously approved these changes Jul 16, 2020
@mergify
Copy link
Contributor

mergify bot commented Jul 16, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed MrArnoldPalmer’s stale review July 16, 2020 23:09

Pull request has been modified.

@BryanPan342 BryanPan342 changed the title fix(appsync): tentative changes that prevent fail with pipelineConfig fix(appsync): resolver unable to set pipelineConfig Jul 17, 2020
/**
* type of resolver
*
* @default - UNIT resolver, single data source
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @default - UNIT resolver, single data source
* @default ResolverType.UNIT

/**
* configuration of the pipeline resolver
*
* @default - create a UNIT resolver
* @default - No pipelineConfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @default - No pipelineConfig
* @default - no pipeline resolver configuration

@@ -19,3 +19,27 @@ test('should not throw an Error', () => {
// Then
expect(when).not.toThrow();
});

test('should not throw an Error', () => {
// Given
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Given
// GIVEN

// Given
const stack = new cdk.Stack();

// When
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// When
// WHEN

});
};

// Then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Then
// WHEN

@@ -19,3 +19,27 @@ test('should not throw an Error', () => {
// Then
expect(when).not.toThrow();
});

test('should not throw an Error', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about a more descriptive name that contain the conditions under test

};

// Then
expect(when).not.toThrow();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we verify the expected cloudformation template?

@mergify mergify bot dismissed shivlaks’s stale review July 17, 2020 01:42

Pull request has been modified.

@BryanPan342 BryanPan342 requested a review from shivlaks July 17, 2020 16:25
Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also add a README example to cover usage of the pipeline config?

*/
readonly pipelineConfig?: CfnResolver.PipelineConfigProperty | IResolvable;
readonly pipelineConfig?: string[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be more strongly typed? or is there a good reason why strings would be ideal?

this motivation for this is not covered in the commit body, can we add that?
it's especially important since this is a breaking change (also needs mention in commit body)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmmm originally the type would have been this:

{
  functions: [...]
}

where the functions parameter just took a string [] anyways, so changed it to just a string [] after following Mitch's suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also is this a breaking change?

the pipelineConfig prop doesn't actually do anything

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have an issue for pipelineConfig doing nothing?

consider this:

  • user has a CDK application where they have specified a pipelineConfig of type PipelineConfigProperty

after this change, when they "upgrade" and just build.. it will fail saying the type is not a match. They have not changed anything about their application other than upgrade, but their build is now failing.

I think it would break which is why I'd consider this to be a breaking change. what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivlaks issue is here #6923

Flattening out the object is a convenience I think since it's the only property. Technically cfn could add more optional properties in the future and we would have to handle those but that happens either way.

I think the more strongly typed could be 'IFunction[]'. @BryanPan342 does that make sense to you?

@BryanPan342 BryanPan342 added pr/breaking-change This PR is a breaking change. It needs to be modified to be allowed in the current major version. and removed pr/breaking-change This PR is a breaking change. It needs to be modified to be allowed in the current major version. labels Jul 20, 2020
@shivlaks shivlaks added the pr/do-not-merge This PR should not be merged at this time. label Jul 23, 2020
shivlaks
shivlaks previously approved these changes Jul 23, 2020
Copy link
Contributor

@shivlaks shivlaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. added a do-not-merge so @MrArnoldPalmer can also have a look

Copy link
Contributor

@MrArnoldPalmer MrArnoldPalmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think typing to 'IFunction[]' for pipelineConfig probably makes sense. We can also change the property name to 'pipelineFunctions' to make it more descriptive and different to the L1 prop.

@BryanPan342
Copy link
Contributor Author

I think typing to 'IFunction[]' for pipelineConfig probably makes sense. We can also change the property name to 'pipelineFunctions' to make it more descriptive and different to the L1 prop.

@MrArnoldPalmer so pipelineConfig doesn't take Lambda Functions. It takes AppSync's own type of Functions that use VTL to perform operations.

See documentation on pipelineConfig here.

See documentation on functionConfiguration here.

See documentation on appsync:CreateFunction here.

I opened up an issue #9092 for a feature request for AppSync function creation. Currently you can make an L1 version of it. But the pipelineConfg prop only takes a name of a AppSync Function.

MrArnoldPalmer
MrArnoldPalmer previously approved these changes Jul 24, 2020
@BryanPan342 BryanPan342 removed the pr/do-not-merge This PR should not be merged at this time. label Jul 24, 2020
@mergify
Copy link
Contributor

mergify bot commented Jul 24, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed stale reviews from MrArnoldPalmer and shivlaks July 24, 2020 03:58

Pull request has been modified.

@BryanPan342 BryanPan342 requested a review from shivlaks July 24, 2020 16:45
@mergify
Copy link
Contributor

mergify bot commented Jul 24, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 3acd9f0
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Jul 24, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit dac9bb3 into aws:master Jul 24, 2020
curtiseppel pushed a commit to curtiseppel/aws-cdk that referenced this pull request Aug 11, 2020
**[ISSUE]**
`pipelineConfig` was be labeled as `undefined` while using the `Resolver` class instead of `createResolver`. Also, no way to set `kind` parameter for resolvers, so implemented that as well.

**[APPROACH]**
Created a property that takes `pipelineConfig` for `AppSync` functions. 

**[NOTE]**
`pipelineConfig` takes a string array for the name of `AppSync Functions` not `Lambda Functions`

Fixes aws#6923  

BREAKING CHANGE: `pipelineConfig` is now an array of `string` instead of `CfnResolver.PipelineConfigProperty` for usability.
- **appsync**: `pipelineConfig` parameter takes in `string []`

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@BryanPan342 BryanPan342 deleted the appsysnc-pipelineConfig branch September 8, 2020 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-appsync Related to AWS AppSync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pipeline config not showing up on synth output
4 participants