-
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
GraphqlApi: Creating GraphqlApi and providing definition using fromSourceApis method , Dependency is not being added between AWS::AppSync::SourceApiAssociation resource and AWS::AppSync::GraphQLSchema which causes creation failures #29044
Closed
rahuldeverani opened this issue
Feb 9, 2024
· 2 comments
· Fixed by #29455 or rwlxxvii/containers#124 · May be fixed by NOUIY/aws-solutions-constructs#98, NOUIY/aws-solutions-constructs#99 or NOUIY/aws-solutions-constructs#101
Closed
GraphqlApi: Creating GraphqlApi and providing definition using fromSourceApis method , Dependency is not being added between AWS::AppSync::SourceApiAssociation resource and AWS::AppSync::GraphQLSchema which causes creation failures #29044
rahuldeverani opened this issue
Feb 9, 2024
· 2 comments
· Fixed by #29455 or rwlxxvii/containers#124 · May be fixed by NOUIY/aws-solutions-constructs#98, NOUIY/aws-solutions-constructs#99 or NOUIY/aws-solutions-constructs#101
Labels
@aws-cdk/aws-appsync
Related to AWS AppSync
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Comments
rahuldeverani
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
Feb 9, 2024
Thank you for the report and workaround. Looks like we need an PR to implicitly add the dependency. |
pahud
added
p2
effort/medium
Medium work item – several days of effort
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
Feb 9, 2024
1 task
1 task
mergify bot
pushed a commit
that referenced
this issue
Apr 9, 2024
### Issue # (if applicable) Closes #29044. ### Reason for this change When associating between the source GraphQL API and the merged API using `fromSourceApis`, generated association resource doesn't depend on the source GraphQL schema. ```ts // This API has `CfnGraphQLSchema` by `definition` prop const firstApi = new appsync.GraphqlApi(stack, 'FirstSourceAPI', { name: 'FirstSourceAPI', definition: appsync.Definition.fromFile(path.join(__dirname, 'appsync.merged-api-1.graphql')), }); // This merged API generates `CfnSourceApiAssociation` new appsync.GraphqlApi(stack, 'MergedAPI', { name: 'MergedAPI', definition: appsync.Definition.fromSourceApis({ sourceApis: [ { sourceApi: firstApi, mergeType: appsync.MergeType.MANUAL_MERGE, }, ], }), }); ``` The same is true if the `SourceApiAssociation` construct is used explicitly. ```ts // This API has `CfnGraphQLSchema` by `definition` prop const firstApi = new appsync.GraphqlApi(stack, 'FirstSourceAPI', { name: 'FirstSourceAPI', definition: appsync.Definition.fromFile(path.join(__dirname, 'appsync.merged-api-1.graphql')), }); // This merged API does not generate `CfnSourceApiAssociation` const mergedApi = new appsync.GraphqlApi(stack, 'MergedAPI', { name: 'MergedAPI', definition: appsync.Definition.fromSourceApis({ sourceApis: [], mergedApiExecutionRole: mergedApiExecutionRole, }), }); // This construct has `CfnSourceApiAssociation` new appsync.SourceApiAssociation(stack, 'SourceApiAssociation1', { sourceApi: firstApi, mergedApi: mergedApi, mergeType: appsync.MergeType.MANUAL_MERGE, mergedApiExecutionRole: mergedApiExecutionRole, }); ``` ### Description of changes The `sourceApi` passed by the `fromSourceApis` method or the `SourceApiAssociation` construct has `addSchemaDependency` method. Using this method, we can make the association to depend on the schema in the `sourceApi`. But, if the api is an IMPORTED resource to begin with, it has no schema in the CDK layer, so there is nothing we can do about it. (The method does nothing.) ### Description of how you validated changes Both unit and existing integ tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
This was referenced May 23, 2024
This was referenced Jun 14, 2024
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.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
When we create mergedAPI using GraphqlApi class and provide the firstApi as sourceApi , and use fromSourceApis method to provide definition of merged API then cloudformation deployment fails with the error:
Resource handler returned message: "Failed to merge source API: to Merged API: with the following error: There's no types found in this API
Expected Behavior
CDK should implicitly add dependency in the template such that AWS::AppSync::SourceApiAssociation for merged api is created after AWS::AppSync::GraphQLSchema of sourceapi.
Current Behavior
Currently , in the generated template , the resource AWS::AppSync::SourceApiAssociation does not wait for the creation of AWS::AppSync::GraphQLSchema for the sourceApi which leads to this error.
Reproduction Steps
Possible Solution
Add depends on between the resources such that AWS::AppSync::SourceApiAssociation depends on AWS::AppSync::GraphQLSchema
workaround :
manually add the dependency in cdk code:
mergedApi.node.addDependency(firstApi);
Additional Information/Context
No response
CDK CLI Version
2.124.0
Framework Version
No response
Node.js Version
v20.8.1
OS
MacOs
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: