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.

cdk deploy may fail with cache directory error

See original GitHub issue

I was trying to update from 1.28.0 to 1.29.0+ and I saw that my artefacts may not be uploaded with an fail: EEXIST: file already exists, mkdir 'cdk.out/.cache' error.

Reproduction Steps

Update from cdk 1.28.0 to a newer one

Error Log

with cdk deploy, I get:


> node@0.1.0 cdk /app
> cdk "deploy" "myproject-test"

(node:16) ExperimentalWarning: The fs.promises API is experimental
Init loading cdk profile plugin PluginHost { credentialProviderSources: [] }
myproject-test: deploying...
[0%] start: Publishing e89c8429b8376dbc4094a7f71f3662a0c7f7b9efd64d99acea102e7fdd33d1a1:current
[5%] fail: EEXIST: file already exists, mkdir 'cdk.out/.cache'
[5%] start: Publishing 5741f85917ffca30b209ad61e375d3d3bae0457270071f7aca8ca81be19bd22a:current
[11%] success: Published 5741f85917ffca30b209ad61e375d3d3bae0457270071f7aca8ca81be19bd22a:current
[11%] start: Publishing a9125fa9a40550c71cde90bd478cc23091e868067a12380c1df0827d013ad2ff:current
[17%] success: Published a9125fa9a40550c71cde90bd478cc23091e868067a12380c1df0827d013ad2ff:current
[17%] start: Publishing 5f9e1b421ff76b3fedba0d495386920c1ca519a4432710870736622d6266d4a9:current
[23%] success: Published 5f9e1b421ff76b3fedba0d495386920c1ca519a4432710870736622d6266d4a9:current
[23%] start: Publishing 3d2960c1b1105a3ee7e05a913c54aa7bf03ac2fc0edb4f34561664d3abe58531:current
[29%] success: Published 3d2960c1b1105a3ee7e05a913c54aa7bf03ac2fc0edb4f34561664d3abe58531:current
[29%] start: Publishing cbf9d46e9ef1730fb8b46af74e35cd167a540d5d930e9a9fb15063702ff883c3:current
[35%] success: Published cbf9d46e9ef1730fb8b46af74e35cd167a540d5d930e9a9fb15063702ff883c3:current
[35%] start: Publishing aa6872c5e59d047daa3735c599a272ae339a6765359d61c463e9105af753017d:current
[41%] success: Published aa6872c5e59d047daa3735c599a272ae339a6765359d61c463e9105af753017d:current
[41%] start: Publishing 070cf22601c22835599c2860fead17a1902f63206810f5db50150493126a49e8:current
[47%] success: Published 070cf22601c22835599c2860fead17a1902f63206810f5db50150493126a49e8:current
[47%] start: Publishing 6db14871b4145ebb15966cc989d4dff59072ea96972c144db9169312bb85fe32:current
[52%] success: Published 6db14871b4145ebb15966cc989d4dff59072ea96972c144db9169312bb85fe32:current
[52%] start: Publishing e2e3ecebf7101466ff068f81ffbe8a0a4d73c193d5e677e30daf7b21aae7bf3f:current
[58%] success: Published e2e3ecebf7101466ff068f81ffbe8a0a4d73c193d5e677e30daf7b21aae7bf3f:current
[58%] start: Publishing d32c0c47a877cd1f901e1d648994763a2f4ee28cc140882f289ee2fba979da65:current
[64%] success: Published d32c0c47a877cd1f901e1d648994763a2f4ee28cc140882f289ee2fba979da65:current
[64%] start: Publishing 002c7d9fe91db27f9674ad958c833b7c8d3285597a5f0a7fdb8c91ceda3ba4c2:current
[70%] fail: EEXIST: file already exists, mkdir 'cdk.out/.cache'
[70%] start: Publishing 2cac6af03b366620f963cda2d8f9542d12c73d50a1d83dcb0ec4b18636f159c6:current
[76%] fail: EEXIST: file already exists, mkdir 'cdk.out/.cache'
[76%] start: Publishing 1456471231f298836dc5f475eeb4e242df7cb80edad3d5274e8bc24f0b6a04da:current
[82%] fail: EEXIST: file already exists, mkdir 'cdk.out/.cache'
[82%] start: Publishing 4fc7bb8a5280811831ad78308171bd7ccd8a13056f1ac0f8b8463eb03a6c675f:current
[88%] success: Published 4fc7bb8a5280811831ad78308171bd7ccd8a13056f1ac0f8b8463eb03a6c675f:current
[88%] start: Publishing 802d60eafad76c29bd45ff72fe0e46eb510ee7ec36448a333e46269b754c22aa:current
[94%] fail: EEXIST: file already exists, mkdir 'cdk.out/.cache'
[94%] start: Publishing a088894be20e45552fb4dcfdc7f9a46507eae8411381790235136f62e3387844:current
[100%] success: Published a088894be20e45552fb4dcfdc7f9a46507eae8411381790235136f62e3387844:current

 ❌  myproject-test failed: Error: Failed to publish one or more assets. See the error messages above for more information.
Failed to publish one or more assets. See the error messages above for more information.

Environment

  • CLI Version : 1.32.1
  • Framework Version:
  • OS : Linux
  • Language : JavaScript

Other

I saw this happened when I was on Node 10.3 (the earliest documented supported by cdk)

image

Not sure if the issue is as hinted by (node:16) ExperimentalWarning: The fs.promises API is experimental

I tried with node 11 or 13 and the issue was gone (and the latter warning was gone too)

I think the resolution for this issue should either drop support for Node 10.x or provide a solution that will work will old versions of Node.


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rix0rrrcommented, Apr 10, 2020

Ah, thanks for that command line. I will binary search for the minimum required Node 10.x version now 😃

0reactions
rix0rrrcommented, Apr 10, 2020

Running this to find the minimum required Node version:

docker run --rm -it node:10.15-slim bash -c 'mkdir thedir; env dir=thedir node -e "const fs = require(\'fs\'); fs.promises.mkdir(process.env.dir, { recursive: true }).then(() => console.log(\'ok\')).catch(e => console.error(e));"'

Well, the documentation actually just states that 10.12 is the first version that supports { recursive: true }, so that’s the one we NEED.

10.17 is the first one that doesn’t complain about fs.promises being experimental anymore, which I guess might be worth something. But for now I think we’re going to raise the minimum suggested version to 10.12.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting common AWS CDK issues
When deploying my AWS CDK stack, I receive a NoSuchBucket error ... commands only in your project's main directory, so the AWS CDK...
Read more >
aws-cdk yarn synth -o /tmp/artifacts returning error ENOENT
A couple of errors existed: Firstable cdk.json app entry needed to point to index.ts "app": "npx ts-node --prefer-ts-exts src/cdk/index.ts".
Read more >
AWS CDK Pipelines: Real-World Tips and Tricks (Part 2)
If you (as a developer) have the permissions to deploy a CDK pipeline, you can just redeploy a new pipeline which will directly...
Read more >
The CDK pipeline construct | tecRacer Amazon AWS Blog
That will not work with Lambda Function Constructs. (Optional) Change .gitignore , otherwise the line *.js can become a problem for ts Lambdas ......
Read more >
How to become an infrastructure-as-code ninja, using AWS CDK
In this directory, we will use the CDK command-line tool to ... The expected result is the CloudFormation that we can deploy to...
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