n8n int cleaning
This commit is contained in:
parent
c0c0151439
commit
93d9cc8a78
@ -32,8 +32,14 @@ export class N8nService {
|
|||||||
throw new Error(`HTTP error! status: ${response.status}, body: ${errorText}`);
|
throw new Error(`HTTP error! status: ${response.status}, body: ${errorText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await response.json();
|
// Handle allEntries format
|
||||||
console.log('Received response from n8n:', JSON.stringify(result, null, 2));
|
const responseText = await response.text();
|
||||||
|
console.log('Raw response from n8n:', responseText);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Try to parse as JSON first
|
||||||
|
const result = JSON.parse(responseText);
|
||||||
|
console.log('Parsed JSON response:', JSON.stringify(result, null, 2));
|
||||||
|
|
||||||
// Handle lastNodeJson format
|
// Handle lastNodeJson format
|
||||||
if (result.lastNodeJson) {
|
if (result.lastNodeJson) {
|
||||||
@ -76,6 +82,19 @@ export class N8nService {
|
|||||||
giteaRepositoryUrl: integrationResults.giteaRepositoryUrl || null
|
giteaRepositoryUrl: integrationResults.giteaRepositoryUrl || null
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} catch (parseError) {
|
||||||
|
console.error('Error parsing response:', parseError);
|
||||||
|
// If parsing fails, return a default success response
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
results: {
|
||||||
|
leantimeProjectId: null,
|
||||||
|
outlineCollectionId: null,
|
||||||
|
rocketChatChannelId: null,
|
||||||
|
giteaRepositoryUrl: null
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error triggering n8n workflow:', error);
|
console.error('Error triggering n8n workflow:', error);
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user