W n8n route
This commit is contained in:
parent
34fc6abad2
commit
cdd4dc127f
File diff suppressed because one or more lines are too long
@ -155,6 +155,15 @@ export async function POST(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const body = await request.json() as MissionCreateInput;
|
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
|
// Validate required fields
|
||||||
const requiredFields = ['name', 'oddScope'];
|
const requiredFields = ['name', 'oddScope'];
|
||||||
|
|||||||
@ -18,6 +18,14 @@ export class N8nService {
|
|||||||
|
|
||||||
async triggerMissionCreation(data: any): Promise<any> {
|
async triggerMissionCreation(data: any): Promise<any> {
|
||||||
try {
|
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
|
// Clean and validate the data
|
||||||
const cleanData = {
|
const cleanData = {
|
||||||
name: data.name,
|
name: data.name,
|
||||||
@ -88,7 +96,7 @@ export class N8nService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const responseText = await response.text();
|
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 to parse the response as JSON
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user