arbisyarifudin / wwebjs-aws-s3

A remote authentication plugin for whatsapp-web.js. Use the AWS S3 to keep your WhatsApp MultiDevice session data safe and secure.
MIT License
3 stars 4 forks source link

Error when trying to save remote session #1

Open pedrorioja opened 8 months ago

pedrorioja commented 8 months ago

`async function initializeClient(user){ const { Client, RemoteAuth } = require('whatsapp-web.js'); const { AwsS3Store } = require('wwebjs-aws-s3'); const { PutObjectCommand, HeadObjectCommand, GetObjectCommand, DeleteObjectCommand } = require('@aws-sdk/client-s3') const s3 = await getS3client() const putObjectCommand = PutObjectCommand; const headObjectCommand = HeadObjectCommand; const getObjectCommand = GetObjectCommand; const deleteObjectCommand = DeleteObjectCommand;

const store = new AwsS3Store({
    bucketName: 'YYYYY',
    remoteDataPath: 'whatsapp/credentials/',
    s3Client: s3,
    putObjectCommand,
    headObjectCommand,
    getObjectCommand,
    deleteObjectCommand
});

const client =  new Client({
    authStrategy: new RemoteAuth({
        clientId: user,
        dataPath: `./.${user}`,
        store: store,
        backupSyncIntervalMs: 600000
    }),
    puppeteer: {
        headless: false
    }
});

client.on('qr', (qr) => {
    console.log('QR RECEIVED', qr);
    qrcode.generate(qr, { small: true });

});

client.on('ready', async() => {
    console.log('Client is ready!');
    await store.save({session: user})
});
await client.initialize();

`

image
arbisyarifudin commented 8 months ago

Hello @pedrorioja, sorry for my late response. Can you give me more details about the errors?