Compare commits

..
2 Commits
Author SHA1 Message Date
Unchained 923f805d47 fix(webhook): normalize event names to uppercase for case-insensitive matching
Build and Deploy / build (push) Has been cancelled
Saleor sends event names in lowercase (order_created) but our code
expects uppercase (ORDER_CREATED). This fix normalizes the event
name before checking supported events.
2026-03-25 14:59:32 +02:00
Unchained 6e0a05c314 fix(k8s): add RESEND_API_KEY and DASHBOARD_URL env vars to deployment
Build and Deploy / build (push) Has been cancelled
2026-03-25 14:26:56 +02:00
2 changed files with 12 additions and 3 deletions
+6
View File
@@ -76,6 +76,8 @@ spec:
value: "https://api.manoonoils.com/graphql/" value: "https://api.manoonoils.com/graphql/"
- name: NEXT_PUBLIC_SITE_URL - name: NEXT_PUBLIC_SITE_URL
value: "https://dev.manoonoils.com" value: "https://dev.manoonoils.com"
- name: DASHBOARD_URL
value: "https://dashboard.manoonoils.com"
volumeMounts: volumeMounts:
- name: workspace - name: workspace
mountPath: /workspace mountPath: /workspace
@@ -108,6 +110,10 @@ spec:
value: "https://api.manoonoils.com/graphql/" value: "https://api.manoonoils.com/graphql/"
- name: NEXT_PUBLIC_SITE_URL - name: NEXT_PUBLIC_SITE_URL
value: "https://dev.manoonoils.com" value: "https://dev.manoonoils.com"
- name: DASHBOARD_URL
value: "https://dashboard.manoonoils.com"
- name: RESEND_API_KEY
value: "re_bewcjHuy_DHtksWVUxguj8vFzKiJZNkFi"
resources: resources:
limits: limits:
cpu: 500m cpu: 500m
+6 -3
View File
@@ -412,14 +412,17 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ error: "Missing saleor-event header" }, { status: 400 }); return NextResponse.json({ error: "Missing saleor-event header" }, { status: 400 });
} }
if (!SUPPORTED_EVENTS.includes(event)) { // Normalize event to uppercase for comparison
console.log(`Event ${event} not supported, skipping`); const normalizedEvent = event.toUpperCase();
if (!SUPPORTED_EVENTS.includes(normalizedEvent)) {
console.log(`Event ${event} (normalized: ${normalizedEvent}) not supported, skipping`);
return NextResponse.json({ success: true, message: "Event not supported" }); return NextResponse.json({ success: true, message: "Event not supported" });
} }
const payload = body; const payload = body;
await handleSaleorWebhook(event, payload); await handleSaleorWebhook(normalizedEvent, payload);
return NextResponse.json({ success: true }); return NextResponse.json({ success: true });
} catch (error) { } catch (error) {