Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs.mkdirSync on app.synth raises EEXIST that should be safely ignored (never happened before) #2344

Open
chneau opened this issue Jan 17, 2025 · 1 comment
Labels
bug Something isn't working needs-triage Priority and effort undetermined yet

Comments

@chneau
Copy link

chneau commented Jan 17, 2025

Description of the bug:

When app.synth()ing, an error is raised if the folder already exists:

Image

this line there:

Image

Reproduction Steps:

synth twice so the first time the folder is created.

Error Log:

        ^
EEXIST: file already exists, mkdir 'dist'
    path: "dist",
 syscall: "mkdir",
   errno: -17,
    code: "EEXIST"

      at synth (/home/c/go/src/github.com/celerumltd/TLS-v4-pipeline/node_modules/cdk8s/lib/app.js:102:12)
(elided from there)

Environment:

  • Framework Version:
  "dependencies": {
  	"@types/bun": "^1.1.17",
  	"cdk8s": "^2.69.33",
  	"cdk8s-plus-31": "^2.0.13",
  	"commander": "^13.0.0",
  	"dayjs": "^1.11.13",
  	"typescript": "^5.7.3"
  }

Bun version 1.1.44
Node version v23.6.0

  • OS:
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

Other:

I wanted to be sure it's not coming from Bun so I did a simple test file:

import fs from "node:fs";

fs.mkdirSync("dist");

and this raise the same error both on Node and Bun.

As a workaround I monkey patch like this so it just continues execution of code. It never happened before with versions back to cdk8s-plus-29

import fs from "node:fs";

const original = fs.mkdirSync;
// @ts-expect-error
fs.mkdirSync = (
	path: fs.PathLike,
	options: fs.MakeDirectoryOptions & {
		recursive: true;
	},
) => {
	try {
		original(path, options);
	} catch (error) {
		console.log(error);
	}
};

This is 🐛 Bug Report

@chneau chneau added bug Something isn't working needs-triage Priority and effort undetermined yet labels Jan 17, 2025
@jrcichra
Copy link

I hit the same bug, I think it's a bun regression: oven-sh/bun#16497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Priority and effort undetermined yet
Projects
None yet
Development

No branches or pull requests

2 participants