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

(aws-cognito): Lambda Trigger lambda.Code.fromInline() example should be valid #12930

Closed
douglasnaphas opened this issue Feb 9, 2021 · 2 comments · Fixed by #13732
Closed
Assignees
Labels
@aws-cdk/aws-cognito Related to Amazon Cognito documentation This is a problem with documentation. effort/small Small work item – less than a day of effort p2

Comments

@douglasnaphas
Copy link
Contributor

https://docs.aws.amazon.com/cdk/api/latest/docs/aws-cognito-readme.html#lambda-triggers

The code sample at the above link has

const authChallengeFn = new lambda.Function(this, 'authChallengeFn', {
  runtime: lambda.Runtime.NODEJS_10_X,
  handler: 'index.handler',
  code: lambda.Code.fromInline('auth challenge'),
});

and

userpool.addTrigger(cognito.UserPoolOperation.USER_MIGRATION, new lambda.Function(this, 'userMigrationFn', {
    runtime: lambda.Runtime.NODEJS_10_X,
  handler: 'index.handler',
  code: lambda.Code.fromInline('user migration'),
}));

The argument to lambda.Code.fromInline is supposed to be valid function code, like in the example at Lambda with DLQ:

...
code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
...

It is confusing for readers to have something syntactically invalid like lambda.Code.fromInline('auth challenge') in the docs. We should replace 'auth challenge' and 'user migration' with syntactically valid function code, or use lambda.Code.fromAsset instead of fromInline.


This is a 📕 documentation issue

@douglasnaphas douglasnaphas added documentation This is a problem with documentation. feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 9, 2021
@github-actions github-actions bot added the @aws-cdk/aws-cognito Related to Amazon Cognito label Feb 9, 2021
@nija-at
Copy link
Contributor

nija-at commented Mar 22, 2021

You make a good point @douglasnaphas.

We should just use fromAsset() or replace the property with ellipses instead of being specific to use Code.fromInline(), like -

code: ...

Feel free to submit a PR for this.

@nija-at nija-at added effort/small Small work item – less than a day of effort p2 and removed feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 22, 2021
nija-at pushed a commit that referenced this issue Mar 22, 2021
Some minor clarification in the docs.

closes #12932
closes #12931
closes #12930
@mergify mergify bot closed this as completed in #13732 Mar 22, 2021
mergify bot pushed a commit that referenced this issue Mar 22, 2021
Minor clarification in the docs.

closes #12932
closes #12931
closes #12930


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

nija-at pushed a commit that referenced this issue Mar 23, 2021
Minor clarification in the docs.

closes #12932
closes #12931
closes #12930


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
eladb pushed a commit that referenced this issue Mar 24, 2021
Minor clarification in the docs.

closes #12932
closes #12931
closes #12930


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Aug 26, 2021
Minor clarification in the docs.

closes aws#12932
closes aws#12931
closes aws#12930


----

*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-cognito Related to Amazon Cognito documentation This is a problem with documentation. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants