-
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
(lambda-nodejs): Documentation confusingly imports as lambda
#22003
Comments
lambda
lambda
I think this makes a lot of sense @kylelaker, I agree with your claim that this is an unlikely way to use the package. We'd be happy to accept a PR to change our documentation to make this distinct from the lambda package! I'm not sure what the best name for the new import variable would be though, we could use what you've proposed for now and see if we can think of something better during the review of the PR |
In the `aws-lambda-nodejs`, `aws-lambda-python`, and `aws-lambda-go` package `README`s, the code examples use `lambda` as the name to import the package. This makes the code examples confusing because `rosetta/default.ts-fixture` masks the `import` statement from readers and may confuse them as to why their `lambda` import doesn't work when they use `lambda.NodejsFunction` (or similar). The imports are changed to `nodejs`, `python`, and `go`. While the last (`go`) is in fact a keyword in its own language, so too is `lambda` in Python. This matches the pattern used by other packages' examples (`aws-route53-patterns` for example uses `patterns` as the name for its import in docs). This change should make the docs more clear to new users, who likely started using Lambda using `lambda.Function` and already have a `lambda` import that won't do what they want. Closes #22003 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
In the `aws-lambda-nodejs`, `aws-lambda-python`, and `aws-lambda-go` package `README`s, the code examples use `lambda` as the name to import the package. This makes the code examples confusing because `rosetta/default.ts-fixture` masks the `import` statement from readers and may confuse them as to why their `lambda` import doesn't work when they use `lambda.NodejsFunction` (or similar). The imports are changed to `nodejs`, `python`, and `go`. While the last (`go`) is in fact a keyword in its own language, so too is `lambda` in Python. This matches the pattern used by other packages' examples (`aws-route53-patterns` for example uses `patterns` as the name for its import in docs). This change should make the docs more clear to new users, who likely started using Lambda using `lambda.Function` and already have a `lambda` import that won't do what they want. Closes aws#22003 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the issue
In many projects,
@aws-cdk/aws-lambda
gets imported aslambda
; this makes the code examples at https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda_nodejs-readme.html confusing as users may expect that the existing import they have for theaws-lambda
package will work.The documentation is not incorrect if you have your imports the same as in the
default.ts-fixture
file, doingBut I'd argue that's an unlikely way for users to use this package (as they'll often still need other exported values from
aws-lambda
).I'd be happy to open a PR to rename this to something like:
and to make corresponding updates to the README etc; but I wanted to open an issue to discuss before implementing.
Links
The text was updated successfully, but these errors were encountered: