W n8n route

This commit is contained in:
alma 2025-05-24 08:42:07 +02:00
parent 34fc6abad2
commit cdd4dc127f
3 changed files with 19 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -155,6 +155,15 @@ export async function POST(request: Request) {
}
const body = await request.json() as MissionCreateInput;
// Add detailed logging
console.log('Mission API - Request body:', {
name: body.name,
hasServices: Array.isArray(body.services),
services: body.services,
hasGite: body.services?.includes('Gite'),
isN8nRequest: request.headers.get('x-api-key') === process.env.N8N_API_KEY
});
// Validate required fields
const requiredFields = ['name', 'oddScope'];

View File

@ -18,6 +18,14 @@ export class N8nService {
async triggerMissionCreation(data: any): Promise<any> {
try {
console.log('N8nService - Input data:', {
hasServices: Array.isArray(data.services),
services: data.services,
hasGite: data.services?.includes('Gite'),
missionProcessed: data.missionProcessed,
config: data.config
});
// Clean and validate the data
const cleanData = {
name: data.name,
@ -88,7 +96,7 @@ export class N8nService {
}
const responseText = await response.text();
console.log('Raw response from n8n:', responseText);
console.log('N8nService - Raw response:', responseText);
// Try to parse the response as JSON
try {