langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
28.3k stars 3.65k forks source link

Cannot find file cdk.Dockerfile when using AWS CDK #3440

Open harusametime opened 3 weeks ago

harusametime commented 3 weeks ago

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

dosubot[bot] commented 3 weeks ago

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.