fix(RemoteAuth): correct auth zip directory based on writable of cwd#201726
fix(RemoteAuth): correct auth zip directory based on writable of cwd#201726huynhtuandat05december wants to merge 2 commits intowwebjs:mainfrom
Conversation
|
PR #201726 - fix(RemoteAuth): correct auth zip directory based on writable of cwd Looked at the change. The approach makes sense - checking process.cwd() writability at startup and falling back to dataPath if not. One thing to consider: the fallback is silent. If cwd becomes unwritable after initialization (or if someone is debugging why zips ended up in a different location), there's no indication it happened. Not a blocker, but a log.warn or similar would help. Also worth noting: if dataPath is also not writable, the error will surface later during compressSession rather than at construction. The error message at that point won't be obvious. Again, not a blocker for this fix since you're improving the common case, but something to keep in mind. The core logic looks correct. Ship it. |
Description
Fixes
ENOENTfailures when RemoteAuth is paired with remote stores likewwebjs-aws-s3orwwebjs-mongo.Since #3375, the session zip is written to
this.dataPath. However, store adapters (S3, GridFS) open the zip by its relative filename (e.g.RemoteAuth-<sessionId>.zip), which Node resolves againstprocess.cwd(). WhendataPathandcwddiffer, the upload step can't find the file and crashes:This PR resolves a single
zipDirat construction time so the zip lives where store adapters expect it, while preserving #3375 Lambda support:process.cwd()is writable => use it. The zip lands at the path store adapters resolve relative filenames against, so S3 / GridFS uploads succeed.this.dataPath(Lambda's read-only root filesystem, only/tmpwritable — Store RemoteAuth ZIP files inside dataPath #3375).Both the archiver output path (backup => upload to S3 / Mongo) and the extract path (download => restore) use
this.zipDir, so the write and read locations stay consistent.Related Issue(s)
closes #5781
Testing Summary
Test Details
Environment
211205363c06b0a4d35f0047adce07da937ffc19Type of Change
Checklist
npm test).index.d.ts) have been updated if necessary.example.js) / documentation have been updated if applicable.