diff --git a/packages/nodejs/.changesets/fix-writable-check-in-diagnose-report.md b/packages/nodejs/.changesets/fix-writable-check-in-diagnose-report.md new file mode 100644 index 00000000..ae60a503 --- /dev/null +++ b/packages/nodejs/.changesets/fix-writable-check-in-diagnose-report.md @@ -0,0 +1,5 @@ +--- +bump: "patch" +--- + +Fix writable check for paths in the diagnose report. Previously it only checked if a path was readable, not writable. diff --git a/packages/nodejs/src/diagnose.ts b/packages/nodejs/src/diagnose.ts index d673182e..f5cdff12 100644 --- a/packages/nodejs/src/diagnose.ts +++ b/packages/nodejs/src/diagnose.ts @@ -173,7 +173,7 @@ export class DiagnoseTool { uid }, type: getPathType(stats), - writable: isWriteableFile(path) + writable: isWriteable(path) } } catch (_) { paths[key] = { @@ -295,9 +295,9 @@ function reportPath(): string { return path.join(`/tmp/appsignal-${reportPathDigest}-install.report`) } -function isWriteableFile(path: string): boolean { +function isWriteable(path: string): boolean { try { - fs.accessSync(path, fs.constants.R_OK) + fs.accessSync(path, fs.constants.W_OK) return true } catch (e) { return false