-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Description
When starting a web call using @vapi-ai/web, Chrome logs a deprecation warning in the console:
This warning appears immediately when a call is initiated via vapi.start().
Environment
@vapi-ai/webversion: 2.5.2@daily-co/daily-jsversion: 0.85.0 (bundled dependency)- Browser: Chrome (tested on latest stable)
- OS: macOS
Root Cause
The deprecation warning originates from the underlying Daily.co SDK (@daily-co/daily-js), which registers an unload event handler internally for WebRTC connection cleanup when users navigate away from the page.
Chrome has been deprecating the unload event since version 117 because:
- It's unreliable and doesn't always fire
- It prevents the back/forward cache (bfcache) from working properly
- It negatively impacts page performance
Reference: https://developer.chrome.com/docs/web-platform/deprecating-unload
Impact
- Current: The warning is informational and does not break functionality
- Future: Chrome is gradually phasing out
unloadhandlers. Eventually they will stop firing entirely unless explicitly opted-in via Permissions-Policy headers
Expected Behavior
No deprecation warnings should appear. The SDK should use modern alternatives like pagehide or visibilitychange events for cleanup operations.
Suggested Fix
This may require coordination with Daily.co to update @daily-co/daily-js to replace unload event handlers with pagehide event handlers, which:
- Are more reliable
- Don't block bfcache
- Are the recommended replacement per Chrome's deprecation guide
Steps to Reproduce
- Install
@vapi-ai/webv2.5.2 - Initialize Vapi with an API key
- Call
vapi.start(assistantId)to begin a web call - Open Chrome DevTools Console
- Observe the deprecation warning
Additional Context
This issue may need to be reported upstream to Daily.co's daily-js repository as well, since the unload handler is registered within their SDK rather than directly in @vapi-ai/web.