fix(Chat Trigger Node): Fix auth in "Embedded Chat" mode (#10734)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions

This commit is contained in:
oleg 2024-09-09 17:33:52 +02:00 committed by GitHub
parent d3861b31ce
commit 96db501a61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -460,20 +460,19 @@ export class ChatTrigger extends Node {
const mode = ctx.getMode() === 'manual' ? 'test' : 'production';
const bodyData = ctx.getBodyData() ?? {};
if (nodeMode === 'hostedChat') {
try {
await validateAuth(ctx);
} catch (error) {
if (error) {
res.writeHead((error as IDataObject).responseCode as number, {
'www-authenticate': 'Basic realm="Webhook"',
});
res.end((error as IDataObject).message as string);
return { noWebhookResponse: true };
}
throw error;
try {
await validateAuth(ctx);
} catch (error) {
if (error) {
res.writeHead((error as IDataObject).responseCode as number, {
'www-authenticate': 'Basic realm="Webhook"',
});
res.end((error as IDataObject).message as string);
return { noWebhookResponse: true };
}
throw error;
}
if (nodeMode === 'hostedChat') {
// Show the chat on GET request
if (webhookName === 'setup') {
const webhookUrlRaw = ctx.getNodeWebhookUrl('default') as string;