Solve CDK recursing asset staging output ENAMETOOLONG error

0

When deploying an aws CDK project, I am intermittently faced with an error containing the following text: Error: ENAMETOOLONG: name too long, copyfile '/opt/app/deploy-project/cdk/cdk.out/asset.549cca69f33e5b267d9a73aff143ef2ac7d7887e7d6fb24186e7c469b1f491ae/deploy-project/cdk/cdk.out/[repeating] It shows a recursion on one of the asset folders and it finally times out after 20 minutes. I have tried some of the solutions I read about in the aws CDK GitHub issues:

  1. add a .dockerignore file to the root of the project with the contents: cdk*
  2. add an exclude property to the DockerImageAsset method:
image = ecr_assets.DockerImageAsset(self, 'DeployDockerImage',
                                            directory=os.path.abspath('../../'),
                                            file="deploy-project.Dockerfile",
                                            exclude=["cdk"]
                                            )

But none of these things have worked. I also should mention that I am using aws-cdk-lib 2.69.0

profile picture
posta un anno fa683 visualizzazioni
1 Risposta
0

Hello

By reviewing the GitHub issue and the code snippet provided, it appears there may be issues in the steps followed for the accepted solutions.

So, can you try the following approach described in the issue:

Excluding cdk.out in asset object instead of cdk


`: image = ecr_assets.DockerImageAsset(self, 'DeployDockerImage',
                                            ..
                                            exclude=['cdk.out']   //  you are excluding cdk
                                            )`

Alternative, the most popular solution suggests:

  1. )added cdk* to .dockerignore to get it working (which you have already done)
  2. ) making sure check cdk.json, it should contain:
{
  "context": {
    "@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true
  }
}

If not specified as true .dockerignore is ignored

AWS
con risposta un anno fa
  • I cannot add { "context": { "@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true } } to my cdk.json file as it causes the following error:

    Error: Unsupported feature flag '@aws-cdk/aws-ecr-assets:dockerIgnoreSupport'. This flag existed on CDKv1 but has been removed in CDKv2. CDK will now behave as the same as when the flag is enabled.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande