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

docs(lambda): Use bundlingImage rather than bundlingDockerImage #13945

Merged
merged 14 commits into from
Apr 15, 2021

Conversation

michaelbrewer
Copy link
Contributor

Resolves #13944

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Apr 1, 2021

@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Apr 1, 2021
@jogold
Copy link
Contributor

jogold commented Apr 1, 2021

Runtimes still expose a bundlingDockerImage property, no?

readonly bundlingDockerImage?: string;

@michaelbrewer
Copy link
Contributor Author

bundlingDockerImage

This actually does not work either.

@michaelbrewer
Copy link
Contributor Author

@jogold if i use bundlingDockerImage i get a casting error in Java. and if bundlingImage it does not actually deploy the code.

@michaelbrewer
Copy link
Contributor Author

Runtimes still expose a bundlingDockerImage property, no?

readonly bundlingDockerImage?: string;

Yes, it does but with typed languages you now have to force a cast:

ie: (Runtime.PYTHON_3_8.bundlingDockerImage as DockerImage?

And the deprecation warning suggests you should use bundlingImage, which does not actually work.

Below is a working example using the now deprecated bundlingDockerImage

        val function = Function(
            this,
            "loan${type.capitalize()}Function",
            FunctionProps
                .builder()
                .functionName("loanDevl")
                .handler("loan.app.lambda_handler")
                .runtime(Runtime.PYTHON_3_8)
                .code(
                    Code.fromAsset(
                        "../../src/",
                        AssetOptions
                            .builder()
                            .bundling(
                                BundlingOptions
                                    .builder()
                                    .image(Runtime.PYTHON_3_8.bundlingDockerImage as DockerImage?)
                                    .command(
                                        mutableListOf(
                                            "bash",
                                            "-c",
                                            "pip install -r requirements.txt -t /asset-output && cp -au . /asset-output"
                                        )
                                    )
                                    .build()
                            )
                            .build()
                    )
                )
                .build()
        )

@michaelbrewer
Copy link
Contributor Author

Seems like these changes are current, I just an issue when running my unit tests and then run the a cdk deploy

@jogold
Copy link
Contributor

jogold commented Apr 2, 2021

And the deprecation warning suggests you should use bundlingImage

you're right!

@michaelbrewer
Copy link
Contributor Author

And the deprecation warning suggests you should use bundlingImage

you're right!

And this would also trigger a compilation error on Java / Kotlin (and i am sure other languages).

What was confusing for me was when i switched bundlingImage switch, it did not properly deployed. It turned out that you need to delete the cdk.out folder if a build fails, otherwise it just uploads the directory specified, but without the dependencies. I am sure there is another issue for that to?

@michaelbrewer
Copy link
Contributor Author

Note @nija-at this causes compile errors in Java runtime

@michaelbrewer
Copy link
Contributor Author

@nija-at will this be merged? It was a time sink for me when I came across this documentation error.

nija-at
nija-at previously approved these changes Apr 13, 2021
@mergify
Copy link
Contributor

mergify bot commented Apr 13, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@michaelbrewer
Copy link
Contributor Author

@nija-at mergify is just hanging now?

@mergify mergify bot dismissed nija-at’s stale review April 14, 2021 13:59

Pull request has been modified.

@michaelbrewer michaelbrewer requested a review from nija-at April 15, 2021 08:08
@michaelbrewer
Copy link
Contributor Author

@nija-at @mergify is not working for me. And this is a PR from my personal github account

Screen Shot 2021-04-15 at 1 18 19 AM

@mergify
Copy link
Contributor

mergify bot commented Apr 15, 2021

@michaelbrewer is not allowed to run commands

Hey, I reacted but my real name is @Mergifyio

@nija-at
Copy link
Contributor

nija-at commented Apr 15, 2021

@michaelbrewer - we're having trouble with Mergify across the repo since yesterday. We will get this merged eventually.

@mergify
Copy link
Contributor

mergify bot commented Apr 15, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 817bc9f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Apr 15, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 0a7157d into aws:master Apr 15, 2021
@michaelbrewer michaelbrewer deleted the docs-BundlingDockerImage branch April 15, 2021 16:49
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…13945)

Resolves aws#13944
----

*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-lambda Related to AWS Lambda
Projects
None yet
4 participants