fix(appsec): log the error when the native WAF binding fails to load#9288
Conversation
Overall package sizeSelf size: 6.71 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 438.86 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
BenchmarksBenchmark execution time: 2026-07-13 10:01:38 Comparing candidate commit 227e856 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2307 metrics, 51 unstable metrics.
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 227e856 | Docs | Datadog PR Page | Give us feedback! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9288 +/- ##
========================================
Coverage 96.57% 96.57%
========================================
Files 918 918
Lines 121577 121577
Branches 21074 20703 -371
========================================
Hits 117407 117407
Misses 4170 4170 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What does this PR do?
When
WAFManager._loadDDWAFfails to load@datadog/native-appsec(missing prebuild, incompatible arch/libc, corrupted binary, etc.), it now passes the caught error tolog.errorinstead of logging only a generic static message. This matches the existing pattern used elsewhere (like here)Motivation
The current log line ('[ASM] AppSec could not load native package. In-app WAF features will not be available.') discards the original error object, so the real root cause (why the binding failed to load) is invisible with DD_TRACE_DEBUG enabled. Customers and support only see that the WAF didn't load, not why. This came up while investigating recurring WAF init failures across several customer environments during the June 2026 site-up review, where this was the identified "quick win" to reduce blindness on this class of issue.
Additional Notes
Reporter.reportWafInitis still called the same way.waf_manager.spec.jsassertinglog.erroris called with the original error and that the error is still thrown.