Update webhook to use GET request and add file details

Correct the HTTP method for the webhook request to GET and include additional file-related headers in server/routes.ts. Also, reorders integrations in .replit for clarity.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: cfbfe47c-0c9a-4ebf-8a41-2937407eccff
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/cfbfe47c-0c9a-4ebf-8a41-2937407eccff/7RlGXpp
This commit is contained in:
michaelschal committed 2025-09-03 12:52:42 +00:00
1 parent f9198a0665
commit 7a37fcacbd
4 files changed
+212 -5

No files matched your search

+1 -1
View File
@@ -37,4 +37,4 @@ args = "npm run dev"
waitForPort = 5000
[agent]
integrations = ["javascript_log_in_with_replit==1.0.0", "javascript_object_storage==1.0.0", "javascript_database==1.0.0"]
integrations = ["javascript_object_storage==1.0.0", "javascript_database==1.0.0", "javascript_log_in_with_replit==1.0.0"]
@@ -0,0 +1,204 @@
endDate: '2025-09-30',
storeId: '1',
userRole: 'manager'
}
🔍 Non-admin orders - filtering by accessible store: { userId: '_1754943032954', role: 'manager', requestedStoreId: 1 }
Deliveries API called with: {
startDate: '2025-09-01',
endDate: '2025-09-30',
storeId: '1',
withBL: undefined,
userRole: 'manager'
}
🔍 Non-admin deliveries - filtering by accessible store: { userId: '_1754943032954', role: 'manager', requestedStoreId: 1 }
📋 API PUBLICITIES REQUEST: {
year: '2025',
filterYear: 2025,
storeId: undefined,
userRole: 'manager'
}
📋 CALLING storage.getPublicities: { filterYear: 2025, groupIds: [ 1 ] }
📋 PUBLICITES FETCHED: 29 résultats pour année 2025
🔍 PREMIERS RESULTATS: [
'1. N°2501 - Blanc',
'2. N°2502 - Moins de 1€ 2€ 3€ 4€ 5€',
'3. N°2503 - Imbattables'
]
📋 PUBLICITIES RETURNED: { count: 29 }
GET /api/publicities 304 in 22ms
📊 Statistiques calculées: {
ordersCount: 12,
deliveriesCount: 10,
pendingOrdersCount: 10,
averageDeliveryTime: 3.6666666666666665,
totalPalettes: 29,
totalPackages: 3
}
GET /api/stats/monthly 200 in 31ms
Orders returned: 12 items
GET /api/orders 200 in 33ms
Deliveries returned: 10 items
GET /api/deliveries 304 in 34ms
GET /api/user 304 in 5ms
GET /api/user 304 in 3ms
HEAD /api/health 200 in 1ms
Orders API called with: {
startDate: undefined,
endDate: undefined,
storeId: undefined,
userRole: 'manager'
}
🔍 Manager orders - using assigned store automatically: {
userId: '_1754943032954',
role: 'manager',
assignedStore: 1,
allUserGroups: [ 1 ]
}
GET /api/suppliers 200 in 8ms
GET /api/user 304 in 9ms
🔗 PRODUCTION: getOrders() récupéré 56 commandes avec relations
Orders returned: 56 items
GET /api/orders 304 in 84ms
HEAD /api/health 200 in 1ms
HEAD /api/health 200 in 0ms
HEAD /api/health 200 in 0ms
HEAD /api/health 200 in 1ms
🔍 BAP: Requête reçue {
hasUser: true,
userType: 'object',
hasClaims: false,
hasId: true,
bodyKeys: [ 'pdfBase64', 'fileName', 'recipient' ]
}
🔍 BAP: User ID extracted: admin_local
🔍 BAP: User found: { id: 'admin_local', role: 'admin' }
📤 BAP: Envoi webhook n8n {
recipient: 'Prissela',
fileName: '20250903_113707.pdf',
fileSize: 344773,
userId: 'admin_local'
}
✅ BAP: Payload JSON préparé {
recipient: 'Prissela',
fileName: '20250903_113707.pdf',
fileSize: 344773
}
🌐 BAP: Envoi vers webhook n8n...
🌐 BAP: Réponse webhook reçue { status: 404, ok: false }
❌ BAP: Erreur webhook {
status: 404,
errorText: '{"code":404,"message":"This webhook is not registered for POST requests. Did you mean to make a GET request?"}'
}
❌ BAP: Erreur complète: {
name: 'Error',
message: 'Erreur webhook: 404 Not Found',
stack: 'Error: Erreur webhook: 404 Not Found\n' +
' at file:///app/dist/index.js:12408:15\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)'
}
POST /api/bap/send-webhook 500 in 41ms
HEAD /api/health 200 in 1ms
Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

+7 -4
View File
@@ -149,14 +149,17 @@ export async function registerRoutes(app: Express): Promise<Server> {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 60000); // 60 secondes
console.log('🌐 BAP: Envoi vers webhook n8n...');
console.log('🌐 BAP: Envoi vers webhook n8n (GET)...');
const response = await fetch(webhookUrl, {
method: 'POST',
method: 'GET',
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'X-PDF-Base64': pdfBase64,
'X-Recipient': recipient,
'X-FileName': fileName,
'X-FileSize': fileBuffer.length.toString()
},
body: JSON.stringify(webhookPayload),
signal: controller.signal
});