Releases: rafaelsg-01/whatsapp-cloudflare-workers
6.7.16-worker-1.0.5
Fix: WhatsApp Account Registration in Production
This PR fixes an issue preventing WhatsApp account registration in production due to high latency when retrieving the creds.json file.
Issue Description
The root cause was in the R2Bucket.put(filePath) function, responsible for storing creds.json. During local development, this operation was fast enough not to cause failures. However, in the production environment, higher latency resulted in the following incorrect flow:
-
The
startSock()function is executed twice during the registration process:- First execution: Requests the verification code and generates
creds.json. - Second execution: Sends the
creds.jsongenerated in the first execution.
- First execution: Requests the verification code and generates
-
The issue occurred because the second execution of
startSock()started beforeR2Bucket.put(filePath)had finished storingcreds.json. As a result, when callingR2Bucket.get(filePath), the value was stillnull, breaking the authentication flow.
Implemented Solution
To ensure creds.json is available before the second execution of startSock(), a verification loop was implemented every 200ms. The process waits until R2Bucket.put(filePath) completes before proceeding to the next registration step.
This approach ensures that production latency does not negatively impact the authentication flow.
6.7.16-worker-1.0.2
Just fixed a bug in dependencies
6.7.16-worker-1.0.1
Minor changes and addition to the readme
6.7.16-worker-1.0.0
Functional version 1 of Baileys WhatsApp for hosting on Cloudflare Workers, current functions:
- Registration of multiple WhatsApp numbers
- Sending messages