question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws_lambda_python.PythonFunction): docker in docker fails

See original GitHub issue

aws_lambda_python.PythonFunction fails at running bundling a python function with requirements.txt

Reproduction Steps

  1. Create python function:
        function = _lambda_python.PythonFunction(
                self, 
                "lambda_function",
                runtime=_lambda.Runtime.PYTHON_3_7,
                handler="main",
                entry="./lambda",
                index="lambda-handler.py"
        )
  1. Run cdk synth

What did you expect to happen?

Not error out? 😃

What actually happened?

Successfully tagged cdk-573ead1ff90e3efe905c76e4e3cbfe9a7282d92e5f2a2b7582566828e7a2ef15:latest
Bundling asset my-python-sample/lambda_function/Code/Stage...
jsii.errors.JavaScriptError: 
  Error: Bundling did not produce any output. Check that content is written to /asset-output.
      at AssetStaging.bundle (/tmp/jsii-kernel-Q2sdku/node_modules/@aws-cdk/core/lib/asset-staging.js:313:19)
      at AssetStaging.stageByBundling (/tmp/jsii-kernel-Q2sdku/node_modules/@aws-cdk/core/lib/asset-staging.js:183:14)
      at stageThisAsset (/tmp/jsii-kernel-Q2sdku/node_modules/@aws-cdk/core/lib/asset-staging.js:64:41)
      at Cache.obtain (/tmp/jsii-kernel-Q2sdku/node_modules/@aws-cdk/core/lib/private/cache.js:28:17)
      at new AssetStaging (/tmp/jsii-kernel-Q2sdku/node_modules/@aws-cdk/core/lib/asset-staging.js:88:48)
      at new Asset (/tmp/jsii-kernel-Q2sdku/node_modules/@aws-cdk/aws-s3-assets/lib/asset.js:28:25)
      at AssetCode.bind (/tmp/jsii-kernel-Q2sdku/node_modules/@aws-cdk/aws-lambda/lib/code.js:225:26)
      at new Function (/tmp/jsii-kernel-Q2sdku/node_modules/@aws-cdk/aws-lambda/lib/function.js:95:33)
      at new PythonFunction (/tmp/jsii-kernel-Q2sdku/node_modules/@aws-cdk/aws-lambda-python/lib/function.js:34:9)
      at /tmp/tmpva3wp68e/lib/program.js:2700:58

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "app.py", line 9, in <module>
    MyPythonSampleStack(app, "my-python-sample", env={'region': 'us-west-2'})
  File "/workspace/git_code/my_python_sample/.venv/lib/python3.8/site-packages/jsii/_runtime.py", line 83, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/workspace/git_code/my_python_sample/my_python_sample/my_python_sample_stack.py", line 26, in __init__
    function = _lambda_python.PythonFunction(
  File "/workspace/git_code/my_python_sample/.venv/lib/python3.8/site-packages/jsii/_runtime.py", line 83, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/workspace/git_code/my_python_sample/.venv/lib/python3.8/site-packages/aws_cdk/aws_lambda_python/__init__.py", line 243, in __init__
    jsii.create(PythonFunction, self, [scope, id, props])
  File "/workspace/git_code/my_python_sample/.venv/lib/python3.8/site-packages/jsii/_kernel/__init__.py", line 265, in create
    response = self.provider.create(
  File "/workspace/git_code/my_python_sample/.venv/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 348, in create
    return self._process.send(request, CreateResponse)
  File "/workspace/git_code/my_python_sample/.venv/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 330, in send
    raise JSIIError(resp.error) from JavaScriptError(resp.stack)
jsii.errors.JSIIError: Bundling did not produce any output. Check that content is written to /asset-output.
Subprocess exited with error 1

Environment

  • CDK CLI Version : 1.88
  • Framework Version:
  • Node.js Version: 14.15.4
  • OS : Ubuntu running on docker, Docker version 20.10.3, build 48d30b5
  • Language (Version): aws-cdk for Python, running Python 3.8.7

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
tvbcommented, Jul 30, 2021

Having the same issue when running cdk synth within GitHub Actions. I’ve been searching for a solution for days now.

1reaction
trobert2commented, Feb 1, 2022

@bafonso would it be possible to share your solution, please? I am facing a similar issue right now

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create AWS Lambda Python function using Docker ...
Today we've created a real example of AWS Lambda Python function from scratch, based on container image. Our function will receive S3 PDF...
Read more >
Deploy Python Lambda functions with container images
AWS provides a Dockerfile for each of the base images to help with building your container image. Open-source runtime interface clients (RIC).
Read more >
Library error on docker container (AWS Lambda)
I'm looking to execute a python script on AWS Lambda using a Docker container loaded on AWS ECR. I've managed to create a...
Read more >
aws-cdk.aws-lambda-python - PyPI
To use this module, you will need to have Docker installed. Python Function. Define a PythonFunction : lambda_.PythonFunction(self, ...
Read more >
Fix Docker Errors When Building a CDK Construct Library with ...
It does, however use Docker, which hadn't been a problem for me in other contexts. ... import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha'; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found