langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Cannot find file cdk.Dockerfile when using AWS CDK

Open harusametime opened this issue 1 year ago • 1 comments

Bug Description

Hi I tried to run AWS CDK on AWS cloud9 and my laptop (Mac book) for deploying Langflow onto AWS, but cdk bootstrap raises the error.

Error: Cannot find file at /Users/masaki/github/langflow/cdk.Dockerfile
    at new DockerImageAsset (/Users/masaki/github/langflow/scripts/aws/node_modules/aws-cdk-lib/aws-ecr-assets/lib/image-asset.js:1:2174)
    at new EcrRepository (/Users/masaki/github/langflow/scripts/aws/lib/construct/ecr.ts:40:37)
    at new LangflowAppStack (/Users/masaki/github/langflow/scripts/aws/lib/cdk-stack.ts:36:38)
    at Object.<anonymous> (/Users/masaki/github/langflow/scripts/aws/bin/cdk.ts:8:1)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module.m._compile (/Users/masaki/github/langflow/scripts/aws/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/masaki/github/langflow/scripts/aws/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1127:12)

This says ecr.ts does not find langflow/cdk.Dockerfile and we can find the file atlangflow/docker/cdk.Dockerfile in this repo. Thus, the following fix on the line may be needed. https://github.com/langflow-ai/langflow/blob/main/scripts/aws/lib/construct/ecr.ts#L22

const backendPath = path.join(__dirname, "../../../../../", "langflow")

should be

const backendPath = path.join(__dirname, "../../../../", "docker")

The fix works for me. Could you check my suggestion?

Reproduction

Following the steps in this readme, we will see the error when running cdk bootstrap. https://github.com/langflow-ai/langflow/tree/main/scripts/aws

Expected behavior

Complete cdk bootstrap without errors.

Who can help?

No response

Operating System

Sonoma 14.4 (mac) and Amazon Linux 2023 (Cloud9)

Langflow Version

1.0.15

Python Version

3.12

Screenshot

No response

Flow File

No response

harusametime avatar Aug 20 '24 00:08 harusametime

Hey @harusametime! I'm here to help you with any bugs, questions, or contributions. Let's tackle this issue together!

Your suggestion to change the path in ecr.ts from:

const backendPath = path.join(__dirname, "../../../../../", "langflow")

to:

const backendPath = path.join(__dirname, "../../../../", "docker")

is correct. This adjustment correctly points to the langflow/docker/cdk.Dockerfile, resolving the issue when running cdk bootstrap [1].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Aug 20 '24 00:08 dosubot[bot]

@harusametime Do you need any assistance with this case? If not, please let us know if this issue can be closed.

carlosrcoelho avatar Nov 07 '24 13:11 carlosrcoelho

Thank you for your contribution! This issue will be closed. If you have any questions or encounter another problem, please open a new issue and we will be ready to help you.

carlosrcoelho avatar Nov 26 '24 01:11 carlosrcoelho

Can we change the file with the fix recommended?

RomainBsb avatar Feb 13 '25 16:02 RomainBsb