Prettier breaks when trying to resolve any broken symlink in the directory it's formatting
Ex:
$ bazel run //:format
INFO: Invocation ID: c783ff80-f59a-40a2-8697-471819826848
INFO: Streaming build results to: https://sodalite.cluster.engflow.com/invocation/c783ff80-f59a-40a2-8697-471819826848
INFO: Analyzed target //:format (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //bazel/format:format up-to-date:
bazel-bin/bazel/format/format
INFO: Elapsed time: 0.456s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Running command line: bazel-bin/bazel/format/format --prettier bazel/format/prettier.sh
INFO: Streaming build results to: https://sodalite.cluster.engflow.com/invocation/c783ff80-f59a-40a2-8697-471819826848
INFO: Build completed successfully, 1 total action
Running command: '[PosixPath('/home/ubuntu/.cache/bazel/_bazel_ubuntu/4f26ed2ae69e3e7a342f434e1dca9056/execroot/__main__/bazel-out/aarch64-fastbuild/bin/bazel/format/prettier.sh'), '.', '!./build', '!./bazel-bin', '!./bazel-out', '!./bazel-mongo', '!./external', '--write']'
/home/ubuntu/.cache/bazel/_bazel_ubuntu/4f26ed2ae69e3e7a342f434e1dca9056/external/aspect_rules_js/js/private/node-patches/fs.js:799
throw err;
^
Error: ENOENT: no such file or directory, readlink '/home/ubuntu/mongo-dev/work/misc1/external'
at enoent (/home/ubuntu/.cache/bazel/_bazel_ubuntu/4f26ed2ae69e3e7a342f434e1dca9056/external/aspect_rules_js/js/private/node-patches/fs.js:818:15)
at /home/ubuntu/.cache/bazel/_bazel_ubuntu/4f26ed2ae69e3e7a342f434e1dca9056/external/aspect_rules_js/js/private/node-patches/fs.js:230:39
at readNextHop (/home/ubuntu/.cache/bazel/_bazel_ubuntu/4f26ed2ae69e3e7a342f434e1dca9056/external/aspect_rules_js/js/private/node-patches/fs.js:489:24)
at readHopLink (/home/ubuntu/.cache/bazel/_bazel_ubuntu/4f26ed2ae69e3e7a342f434e1dca9056/external/aspect_rules_js/js/private/node-patches/fs.js:549:20)
at nextHop (/home/ubuntu/.cache/bazel/_bazel_ubuntu/4f26ed2ae69e3e7a342f434e1dca9056/external/aspect_rules_js/js/private/node-patches/fs.js:487:9)
at args.<computed> (/home/ubuntu/.cache/bazel/_bazel_ubuntu/4f26ed2ae69e3e7a342f434e1dca9056/external/aspect_rules_js/js/private/node-patches/fs.js:226:24)
at FSReqCallback.oncomplete (node:fs:192:23) {
errno: -2,
syscall: 'readlink',
code: 'ENOENT',
path: '/home/ubuntu/mongo-dev/work/misc1/external'
}
Found formatting errors. Run 'bazel run //:format' to fix
*** IF BAZEL IS NOT INSTALLED, RUN THE FOLLOWING: ***
python buildscripts/install_bazel.py
There was a previous attempt to address this in https://jira.mongodb.org/browse/SERVER-94844 but it doesn't look to have completely resolved the issue
See https://github.com/prettier/prettier/issues/11568 for the root cause