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

Pipeline config not showing up on synth output #6923

Closed
tcodes0 opened this issue Mar 21, 2020 · 11 comments · Fixed by #9093
Closed

Pipeline config not showing up on synth output #6923

tcodes0 opened this issue Mar 21, 2020 · 11 comments · Fixed by #9093
Assignees
Labels
@aws-cdk/aws-appsync Related to AWS AppSync bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@tcodes0
Copy link

tcodes0 commented Mar 21, 2020

Screen Shot 2020-03-21 at 3 54 21 PM

Reproduction Steps

const lambdaWithStash = `
#set($ctx.stash.newId = $util.autoId())
{"version": "2017-02-28", "operation": "Invoke", "payload": $util.toJson($ctx)}
`
const passThrough = `$util.toJson($ctx.result)`

export const resolverDefaults = {
  requestMappingTemplate: Appsync.MappingTemplate.fromString(lambdaWithStash),
  responseMappingTemplate: Appsync.MappingTemplate.fromString(passThrough),
}

// this == CDK.Stack
new Appsync.Resolver(this, 'pipeline', {
      ...resolverDefaults,
      api: Graphql, // Appsync.GraphQLApi
      typeName: 'Conversation',
      fieldName: 'messages',
      pipelineConfig: {
        functions: ['lambda1', 'lambda2'] // valid lambdas on my Lambda console
      }
    })

Error Log

see screnshot

Environment

  • CLI Version : 1.27.0 (build a98c0b3)
  • Framework Version: not sure what this means.
  • OS : macos 10.14.6
  • Language : typescript

Other

I'm passing a valid, as per cdk types, pipelineConfig but it shows as undefined in my cdk synth output, causing deploy to fail even though my cdk code looks correct


This is 🐛 Bug Report

@tcodes0 tcodes0 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 21, 2020
@SomayaB SomayaB added in-progress This issue is being actively worked on. @aws-cdk/aws-appsync Related to AWS AppSync labels Mar 25, 2020
@MrArnoldPalmer MrArnoldPalmer added p1 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Mar 25, 2020
@MrArnoldPalmer
Copy link
Contributor

Yeah looks like we are not forwarding pipelineConfig from the L2 to CfnResolver.
https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-appsync/lib/graphqlapi.ts#L1061

imo, we should remove some of the unnecessary information from the pipelineConfig arg as well and make it type Array<string> wrapping it in { functions: } when forwarding to the CfnResolver.

@iamtheworstdev
Copy link

iamtheworstdev commented Apr 6, 2020

@MrArnoldPalmer what do you think is a reasonable eta on this? no pipeline resolvers means using CDK for Appsync is only a partial solution.

@MrArnoldPalmer
Copy link
Contributor

@iamtheworstdev a PR has been submitted but stalled out for now. @Thomazella do you plan on continuing or should we take this over to close it out?

#6924

@tcodes0
Copy link
Author

tcodes0 commented Apr 6, 2020

Please take it over. Seems pretty simple but I'm terribly busy lately 🙏

@MrArnoldPalmer
Copy link
Contributor

@iamtheworstdev feel free to jump in if you want to add some tests and try to get this resolved. Otherwise I'll add it to my list but its a long one at the moment 😉

@iamtheworstdev
Copy link

@MrArnoldPalmer assume I'm not, because it's not just a clever moniker but you probably don't want me writing the code. but I think my work around for avoid pipelines just reached the end of its useful life so I may. I'll comment back in here if I start any work.

@alextriaca
Copy link

Just hit this issue myself today. Took me a while to realise that the pipeline config just wasn't being populated 😅 Any chance this issue could get some love. We're realising more and more how powerful AppSync is and these last few bits polish in CDK will really improve the dev experience.

@vengad-tech
Copy link

Any update on the same ? seems like a bad bug, would be great if you guys can fix it. I am currently blocked on the same

@BryanPan342 BryanPan342 self-assigned this Jul 14, 2020
@BryanPan342
Copy link
Contributor

Hi @alextriaca @Vengadanathan I'll start working on this today, my goal is to complete it and merge by Thursday.

For future reference, please add a 👍 to the issues that you are stuck on that way they can get sorted to the top :)

@BryanPan342
Copy link
Contributor

BryanPan342 commented Jul 16, 2020

I believe the work around to this pipeline would be to create multiple resolvers as follows.

const api = new GraphQLApi(...);

const function1 = new Lambda(...);
const function2 = new Lambda(...);

const lambda1DS = api.addLambdaDataSource('DS1', 'function1', function1);
const lambda2DS = api.addLambdaDataSource('DS2', 'function2', function2);

lambda1DS.createResolver({
  typeName: [TYPE],
  fieldName: [FIELD],
  requestMappingTemplate: [REQUEST],
  responseMappingTemplate: [RESPONSE],
});

lambda2DS.createResolver({
  typeName: [TYPE],
  fieldName: [FIELD],
  requestMappingTemplate: [REQUEST],
  responseMappingTemplate: [RESPONSE],
});

specifically making two different data sources and make separate resolvers for each of them.

@BryanPan342
Copy link
Contributor

BryanPan342 commented Jul 16, 2020

Okay I think I found the root of the confusion.

The Function that can be added to the pipelineConfig is not a Lambda Function. Instead, it is AppSync::Function.

See documentation on pipelineConfig here.

See documentation on functionConfiguration here.

See documentation on appsync:CreateFunction here.

If you want to use Lambda Functions, I suggest using the addLambdaDataSource and createResolver method outlined above.

That being said, CDK doesn't have implementation for AppSync Function so I will close this issue and opening #9092 for a feature request for AppSync function creation.

@BryanPan342 BryanPan342 removed the in-progress This issue is being actively worked on. label Jul 16, 2020
mergify bot pushed a commit that referenced this issue Jul 24, 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*
curtiseppel pushed a commit to curtiseppel/aws-cdk that referenced this issue 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*
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/small Small work item – less than a day of effort p1
Projects
None yet
7 participants