Skip to content

Commit c296f36

Browse files
author
Hamza Shahid
committed
fix: add check for undefined authState before creating client
1 parent 0ef3837 commit c296f36

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "evolution-api",
3-
"version": "2.3.7-railway.2",
3+
"version": "2.3.7-railway.3",
44
"description": "Rest api for communication with WhatsApp",
55
"main": "./dist/main.js",
66
"type": "commonjs",

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,12 @@ export class BaileysStartupService extends ChannelStartupService {
576576
private async createClient(number?: string): Promise<WASocket> {
577577
this.instance.authState = await this.defineAuthState();
578578

579+
if (!this.instance.authState || !this.instance.authState.state) {
580+
throw new BadRequestException(
581+
'Failed to initialize authentication state. Please check database configuration (DATABASE_SAVE_DATA_INSTANCE should be true).',
582+
);
583+
}
584+
579585
const session = this.configService.get<ConfigSessionPhone>('CONFIG_SESSION_PHONE');
580586

581587
let browserOptions = {};

0 commit comments

Comments
 (0)