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-cdk/aws-lambda-python] Azure DevOps - unable to prepare context

See original GitHub issue

Hi, 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
daterrcommented, Jan 11, 2021

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.

0reactions
github-actions[bot]commented, Jan 26, 2022

⚠️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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker build gives "unable to prepare context: context must be ...
The context is a directory and determines what the docker build process is going to see: From the Dockerfile's point of view, ...
Read more >
Unable to prepare context: path "." not found while using ...
I get the error message 'Unable to prepare context: path "." not found' It doesn't work on any of my two computers with...
Read more >
Error saying unable to prepare context unable to evaluate ...
I just downloaded Docker Toolbox for Windows 10 64bit today. I'm trying to pull an image using a dockerfile and getting the following...
Read more >
Error when running docker build on any dockerfile: "unable to ...
$ docker build -t somefile . Every time I run that I get this error: unable to prepare context: unable to evaluate symlinks...
Read more >
unable to evaluate symlinks in Dockerfile path - YouTube
docker build -t golang-mongo-app . unable to prepare context : unable to evaluate symlinks in Dockerfile path: CreateFile ...
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