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

[appsync]: Data Source breaking change #9854

Closed
asnaseer-resilient opened this issue Aug 20, 2020 · 9 comments
Closed

[appsync]: Data Source breaking change #9854

asnaseer-resilient opened this issue Aug 20, 2020 · 9 comments
Assignees
Labels
@aws-cdk/aws-appsync Related to AWS AppSync bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@asnaseer-resilient
Copy link

asnaseer-resilient commented Aug 20, 2020

I just tried the latest CDK v1.60.0 and changed these lines of code in my existing deployment from this:

    const lambdaApiResolverDataSource = graphQlApi.addLambdaDataSource(
      'LambdaApiResolverDataSource',
      `Resolves GraphQL requests for ${product}`,
      lambdaApiResolverFunction
    );

to this:

    const lambdaApiResolverDataSource = graphQlApi.addLambdaDataSource('LambdaApiResolverDataSource', lambdaApiResolverFunction, {
      description: `Resolves GraphQL requests for ${product}`
    });

When the deployment ran, it failed with this:

AppSyncConstructGraphQLLambdaApiResolverDataSourceBAD1E2A7
CREATE_FAILED
Data source with name LambdaApiResolverDataSource already exists (Service: AWSAppSync; Status Code: 400; Error Code: BadRequestException; Request ID: 45ade8da-9b90-432e-9620-0de300aaf18a; Proxy: null)

This is for an existing AppSync deployment. This code was working in the previous release I had (v1.59.0).

Reproduction Steps

As described above.

What did you expect to happen?

The deployment should have succeeded.

What actually happened?

The deployment failed with:

AppSyncConstructGraphQLLambdaApiResolverDataSourceBAD1E2A7
CREATE_FAILED
Data source with name LambdaApiResolverDataSource already exists (Service: AWSAppSync; Status Code: 400; Error Code: BadRequestException; Request ID: 45ade8da-9b90-432e-9620-0de300aaf18a; Proxy: null)

Environment

  • CLI Version : v1.60.0
  • Framework Version:
  • Node.js Version: v12.4.0
  • OS : Deployment ran on CircleCI
  • Language (Version): Typescript 3.9.7

Other


This is 🐛 Bug Report

@asnaseer-resilient asnaseer-resilient added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 20, 2020
@asnaseer-resilient
Copy link
Author

I had to delete my AppSync deployment on AWS and then re-deploy it for it to work again.

@andrestone
Copy link
Contributor

andrestone commented Aug 20, 2020

Probably this changed the construct tree which is what is used to generate the correspondent logical ID in the synthesized template, making CloudFormation think you were creating a new data source.

I'm not sure there's something to be fixed here. Maybe make sure such things appear in the "Breaking Changes"?

@asnaseer-resilient
Copy link
Author

asnaseer-resilient commented Aug 20, 2020

Thanks for tracking it down - and I agree it should definitely have appeared in the "Breaking Changes".

We have 3 APIs that have been deployed to live and a web app that uses them. This breakage meant that I had to delete the 3 APIs and then re-deploy them which caused their corresponding GraphQL endpoints to change. I then had to update my web app with the new endpoints and re-deploy that.

I realise this is an evolving library and really appreciate all the work everyone has put into this. Many people now use this in production and therefore it would be really appreciated if any changes could be made such that they do not imply a re-deployment of resources - I know this is hard but just something to think about.

@BryanPan342
Copy link
Contributor

@andrestone thanks for the initiative in looking into this

@asnaseer-resilient thanks for the feedback! I apologize, I should have written a better commit description highlighting the potential effects. The AppSync module a couple of months ago used to be a monolithic single file with virtually no unit tests. Currently, I have been trying to clean up the library and make sure it functions similarly to the rest of the CDK.

I definitely keep this in mind as I make changes in the future!

@BryanPan342 BryanPan342 changed the title [module] [appsync]: Data Source breaking change Aug 20, 2020
@github-actions github-actions bot added the @aws-cdk/aws-appsync Related to AWS AppSync label Aug 20, 2020
@asnaseer-resilient
Copy link
Author

@BryanPan342 Thanks - and don't get me wrong - I really appreciate the amazing work all of you are putting into this library. It is by far the best deployment framework I have ever worked with (and I have been coding for more than 30 years).

@asnaseer-resilient
Copy link
Author

BTW: I assume you guys are using semantic versioning which states:

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards compatible manner, and
PATCH version when you make backwards compatible bug fixes.

It will therefore help even more if you always change the MAJOR version when making a breaking change.

@MrArnoldPalmer
Copy link
Contributor

@asnaseer-resilient AppSync is currently an "experimental" module, so breaking changes are common at this point. Check out the docs for more information on our current versioning strategy. Regardless this should have been marked as a breaking change.

Modules in the AWS Construct Library are designated Experimental while we build them; experimental modules may have breaking API changes in any release. After a module is designated Stable, it adheres to semantic versioning, and only major releases can have breaking changes. Each module's stability designation is available on its Overview page in the AWS CDK API Reference. For more information, see Versioning in the CDK Developer Guide.

@andrestone
Copy link
Contributor

@asnaseer-resilient You could safely use the Cfn* classes in production, which are stable across all CDK.

@asnaseer-resilient
Copy link
Author

@MrArnoldPalmer Ah - OK - thanks for clarifying this.

@andrestone I prefer to use the CDK classes but thanks for the suggestion.

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 bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

4 participants