full upgrade to dev
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
const fetch = require('node-fetch');
|
||||
require('dotenv').config({ path: '.env.local' });
|
||||
require('dotenv').config({ path: '.env' });
|
||||
const fetch = require("node-fetch");
|
||||
require("dotenv").config({ path: ".env.local" });
|
||||
require("dotenv").config({ path: ".env" });
|
||||
|
||||
const webhookUrl = process.env.N8N_WEBHOOK_URL || 'https://n8n.dk0.dev';
|
||||
const webhookUrl = process.env.N8N_WEBHOOK_URL || "https://n8n.dk0.dev";
|
||||
const fullUrl = `${webhookUrl}/webhook/chat`;
|
||||
|
||||
console.log(`Testing connection to: ${fullUrl}`);
|
||||
@@ -11,30 +11,30 @@ console.log(`Testing connection to: ${fullUrl}`);
|
||||
async function testConnection() {
|
||||
try {
|
||||
const response = await fetch(fullUrl, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ message: "Hello from test script" })
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ message: "Hello from test script" }),
|
||||
});
|
||||
|
||||
console.log(`Status: ${response.status} ${response.statusText}`);
|
||||
|
||||
if (response.ok) {
|
||||
const text = await response.text();
|
||||
console.log('Response body:', text);
|
||||
console.log("Response body:", text);
|
||||
try {
|
||||
const json = JSON.parse(text);
|
||||
console.log('Parsed JSON:', json);
|
||||
} catch (e) {
|
||||
console.log('Could not parse response as JSON');
|
||||
console.log("Parsed JSON:", json);
|
||||
} catch (_e) {
|
||||
console.log("Could not parse response as JSON");
|
||||
}
|
||||
} else {
|
||||
console.log('Response headers:', response.headers.raw());
|
||||
console.log("Response headers:", response.headers.raw());
|
||||
const text = await response.text();
|
||||
console.log('Error body:', text);
|
||||
console.log("Error body:", text);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Connection failed:', error.message);
|
||||
if (error.cause) console.error('Cause:', error.cause);
|
||||
console.error("Connection failed:", error.message);
|
||||
if (error.cause) console.error("Cause:", error.cause);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user