-
Notifications
You must be signed in to change notification settings - Fork 4
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
Not loading session from remote #2
Comments
Hello @viniciusbig , can you give more details about your code? |
Sure! here is the piece I think its relevant
client is initialized and the The file is correct downloaded and extracted. But it seems its being ignored by the client |
Same problem here const s3 = new S3Client({
region: config.s3.region,
credentials: {
accessKeyId: config.s3.accessKeyId,
secretAccessKey: config.s3.secretAccessKey
},
})
const putObjectCommand = PutObjectCommand;
const headObjectCommand = HeadObjectCommand;
const getObjectCommand = GetObjectCommand;
const deleteObjectCommand = DeleteObjectCommand;
const store = new AwsS3Store({
bucketName: config.s3.bucket,
remoteDataPath: 'whatsapp_sessions/',
s3Client: s3,
putObjectCommand,
headObjectCommand,
getObjectCommand,
deleteObjectCommand
});
const authStrategy = new RemoteAuth({
backupSyncIntervalMs: 300000,
store,
clientId,
dataPath: "./.wwwebjs_auth"
})
const client = new Client({
authStrategy: authStrategy,
qrMaxRetries: 5,
puppeteer: {
headless: true,
args: ['--no-sandbox']
}
})
return client Environment: ubuntu 20-04 |
Same here
|
Updates: I hope help you!. import AdmZip from "adm-zip"
import * as fs from "fs-extra"
import * as path from "path"
import WAWebJS, { RemoteAuth } from "whatsapp-web.js"
interface RemoteAuthOptions {
clientId?: string
dataPath?: string
store: WAWebJS.Store
backupSyncIntervalMs: number
}
export class CustomRemoteAuth extends RemoteAuth {
private userDataDir: string
constructor(options: RemoteAuthOptions) {
super(options)
const sessionDirName = options.clientId ? `RemoteAuth-${options.clientId}` : 'RemoteAuth'
this.userDataDir = path.join(options?.dataPath ?? '', sessionDirName)
}
async unCompressSession(compressedSessionPath: string): Promise<void> {
await new Promise((resolve, reject) => {
const zip = new AdmZip(compressedSessionPath)
zip.extractAllToAsync(this.userDataDir, true, false, (err) => {
console.log("#######", this.userDataDir, compressedSessionPath)
if(err)
{ reject(err) }
else
{ resolve(null) }
})
})
await fs.promises.unlink(compressedSessionPath)
}
} |
It's a whatsapp-web.js issue Solved using that pr: pedroslopez/whatsapp-web.js#2412 |
After a succesfull login, the zip file is saved on my S3.
When I restart my app, I can see the session file is downloaded from S3, but the whatsapp client is not logged, it keep asking for the QR Code.
Is there anything missing to use the session saved in the bucket?
The text was updated successfully, but these errors were encountered: