mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 04:02:54 -06:00
Fix events structure to prevent "Instance not found" exception
This commit is contained in:
parent
475fced33b
commit
6585e8f0c2
@ -52,6 +52,8 @@ export class InstanceController {
|
|||||||
|
|
||||||
const instanceId = v4();
|
const instanceId = v4();
|
||||||
|
|
||||||
|
instanceData.instanceId = instanceId;
|
||||||
|
|
||||||
let hash: string;
|
let hash: string;
|
||||||
|
|
||||||
if (!instanceData.token) hash = v4().toUpperCase();
|
if (!instanceData.token) hash = v4().toUpperCase();
|
||||||
@ -75,16 +77,16 @@ export class InstanceController {
|
|||||||
businessId: instanceData.businessId,
|
businessId: instanceData.businessId,
|
||||||
});
|
});
|
||||||
|
|
||||||
instance.sendDataWebhook(Events.INSTANCE_CREATE, {
|
|
||||||
instanceName: instanceData.instanceName,
|
|
||||||
instanceId: instanceId,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.waMonitor.waInstances[instance.instanceName] = instance;
|
this.waMonitor.waInstances[instance.instanceName] = instance;
|
||||||
this.waMonitor.delInstanceTime(instance.instanceName);
|
this.waMonitor.delInstanceTime(instance.instanceName);
|
||||||
|
|
||||||
// set events
|
// set events
|
||||||
eventController.setInstance(instance.instanceName, instanceData);
|
await eventController.setInstance(instance.instanceName, instanceData);
|
||||||
|
|
||||||
|
instance.sendDataWebhook(Events.INSTANCE_CREATE, {
|
||||||
|
instanceName: instanceData.instanceName,
|
||||||
|
instanceId: instanceId,
|
||||||
|
});
|
||||||
|
|
||||||
if (instanceData.proxyHost && instanceData.proxyPort && instanceData.proxyProtocol) {
|
if (instanceData.proxyHost && instanceData.proxyPort && instanceData.proxyProtocol) {
|
||||||
const testProxy = await this.proxyService.testProxy({
|
const testProxy = await this.proxyService.testProxy({
|
||||||
|
@ -102,7 +102,7 @@ export class RabbitmqController extends EventController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return null;
|
throw new NotFoundException('Instance websocket not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -88,7 +88,7 @@ export class SqsController extends EventController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return null;
|
throw new NotFoundException('Instance websocket not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -62,7 +62,7 @@ export class WebhookController extends EventController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return null;
|
throw new NotFoundException('Instance websocket not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -99,7 +99,7 @@ export class WebsocketController extends EventController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return null;
|
throw new NotFoundException('Instance websocket not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
Loading…
Reference in New Issue
Block a user