ServiceWorker registration fails in Facebook/Instagram in-app browser on iOS
- 主要語言
- TypeScript
- 星號
- 7.8k
- 分支
- 2.2k
- 平均合併
- 22 小時 28 分鐘
- 30 天內合併 PR
- 6
描述
When using the Firebase Messaging service with Angular 19.1.4 in the Facebook/Instagram in-app browser on iOS devices, the following error occurs:
```typescript
TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.addEventListener')
```
### Environment
- **Platform**: iOS
- **Browser**: Facebook/Instagram in-app browser
- **Framework**: Angular 19.1.4
- **Dependencies**:
- @angular/core: 19.1.4
- @angular/common: 19.1.4
- @angular/platform-browser: 19.1.4
- **Service**: Firebase Cloud Messaging
### Technical Details
The error occurs during the messaging service initialization when attempting to add an event listener to the ServiceWorker. The specific line causing the issue is:
```typescript
navigator.serviceWorker.addEventListener('message', e => messageEventListener(messaging as MessagingService, e));
```
### Root Cause
The Facebook/Instagram in-app browser on iOS does not support or properly expose the ServiceWorker API, causing `navigator.serviceWorker` to be undefined. This issue persists even with the latest Angular 19 framework.
### Impact
- Firebase Cloud Messaging service initialization fails
- Push notifications cannot be registered or received
- Affects only users accessing the Angular 19 application through Facebook/Instagram in-app browser on iOS devices
貢獻指南
研究方向
從 issue 中顯示的 messaging-service 初始化呼叫開始,並在 Facebook/Instagram 的 iOS 應用程式內瀏覽器中重現它。追蹤 navigator.serviceWorker 的存取方式;當 API 無法使用時初始化不再擲出錯誤,且已在支援的環境中驗證 push 行為,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- angular, firebase, typescript
- 領域
- frontend
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100