[@aws-cdk/aws-lambda-python] Azure DevOps - unable to prepare context
See original GitHub issueHi, I have a project with a python3.8 lambda and Pipfile (I have also tried requirements.txt
). When I try to deploy it in the Azure DevOps pipeline with command cdk deploy --require-approval=never
I get error:
unable to prepare context: the Dockerfile (.../node_modules/@aws-cdk/aws-lambda-python/lib/Dockerfile.dependencies) must be within the build context
From the other project I know that it works in similar environment with requirements.txt
in the 1.63
version. I have also verified that if I revert cdk in this project to 1.63
and remove Pipfile
it is also working. Deployment from my own machine works in all cases. I have temporary reverted to 1.63
and use pipenv lock
to be able to deploy this project.
Reproduction Steps
cdk file:
import { PythonFunction } from "@aws-cdk/aws-lambda-python";
import * as cdk from "@aws-cdk/core";
export class Stack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props: cdk.StackProps) {
super(scope, id, props);
new PythonFunction(this, "SomeFunction", {
handler: "handler",
entry: "./src",
index: "handler.py",
runtime: Runtime.PYTHON_3_8,
// ...
});
}
}
and src contains handler.py
with handler
and Pipfile
with dependencies.
What did you expect to happen?
Correct deployment of the lambda in the pipeline like on my machine.
What actually happened?
Error:
unable to prepare context: the Dockerfile (.../node_modules/@aws-cdk/aws-lambda-python/lib/Dockerfile.dependencies) must be within the build context
Environment
- CDK CLI Version : 1.74.0
- Framework Version: 1.74.0
- Node.js Version: 12
- OS : ubuntu-latest (vmImage)
- Language (Version): Python 3.8
Other
From what I have seen the file Dockerfile.dependencies
is not present in the working 1.63
version.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top GitHub Comments
I ran into this issue using Jenkins for CI/CD. In my case, the solution was to upgrade the version of Docker being run (it was using 17.something before), to 19.03.14 (the latest stable). I’m not sure what the minimum version needed is, but it would be helpful if that information could be included in the documentation.
⚠️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.