Skip to content

fix(RemoteAuth): pass session name to store.save instead of full path#201660

Open
Adi1231234 wants to merge 4 commits intowwebjs:mainfrom
Adi1231234:fix/remote-auth-store-save-session-name
Open

fix(RemoteAuth): pass session name to store.save instead of full path#201660
Adi1231234 wants to merge 4 commits intowwebjs:mainfrom
Adi1231234:fix/remote-auth-store-save-session-name

Conversation

@Adi1231234
Copy link
Contributor

@Adi1231234 Adi1231234 commented Mar 15, 2026

store.save() in storeRemoteSession is passing path.join(this.dataPath, this.sessionName) as the session identifier, but every other store call in the file (sessionExists, extract, delete) passes just this.sessionName. Because of this mismatch, the session gets saved under the full local filesystem path as the remote key, so on the next startup sessionExists can't find it and the session is lost.

This is what people end up seeing in S3 (or any other remote store):

sessions/home/user/project/.wwebjs_session/default-customer/RemoteAuth-default-customer.zip

instead of:

sessions/RemoteAuth-default-customer.zip

The path.join(this.dataPath, ...) part makes sense for the actual zip file on disk, and compressSession already handles that correctly. The session: parameter is just the remote key, it has nothing to do with where the zip lives locally.

Fix is a one-liner: pass this.sessionName to store.save(), same as the other three store calls.

Regression introduced in e6fd112. Working on 1.36.2, broken on 1.36.4.

store.save() was receiving path.join(this.dataPath, this.sessionName)
instead of just this.sessionName. This caused remote stores (e.g. S3)
to use the full local filesystem path as the storage key, resulting in
zip files being saved under paths like:
  sessions/Users/user/project/.wwebjs_session/default/RemoteAuth-default.zip
instead of:
  sessions/RemoteAuth-default.zip

all other store calls (sessionExists, extract, delete) already pass
this.sessionName correctly. This brings store.save in line with them.

the local filesystem operations (creating and cleaning up the zip file)
continue to use path.join(this.dataPath, ...) which is correct.

regression introduced in e6fd112.
@github-actions github-actions bot added the api changes API modifications label Mar 15, 2026
@BenyFilho BenyFilho added the approved Confirmed by maintainers label Mar 15, 2026
Adi1231234 added a commit to Adi1231234/whatsapp-web.js that referenced this pull request Mar 16, 2026
…127083

- RemoteAuth: pass session name directly to store.save instead of full
  path (fixes PR wwebjs#201660 - path.join was passing the full filesystem
  path instead of just the session identifier)

- Client: register framenavigated listener before calling inject() so
  any page navigation that occurs during initialization is captured
  (fixes PR wwebjs#127083 ordering issue)
Adi1231234 added a commit to Adi1231234/whatsapp-web.js that referenced this pull request Mar 16, 2026
…127083 (#65)

- RemoteAuth: pass session name directly to store.save instead of full
  path (fixes PR wwebjs#201660 - path.join was passing the full filesystem
  path instead of just the session identifier)

- Client: register framenavigated listener before calling inject() so
  any page navigation that occurs during initialization is captured
  (fixes PR wwebjs#127083 ordering issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api changes API modifications approved Confirmed by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants