ServiceWorker registration fails in Facebook/Instagram in-app browser on iOS
- Ngôn ngữ chính
- TypeScript
- Star
- 7.8k
- Fork
- 2.2k
- Merge trung bình
- 22 giờ 28 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu từ lệnh gọi khởi tạo messaging-service được hiển thị trong issue và tái hiện lệnh gọi đó trong trình duyệt trong ứng dụng iOS của Facebook/Instagram. Theo dõi cách navigator.serviceWorker được truy cập; hoàn tất khi quá trình khởi tạo không còn ném lỗi khi API không khả dụng và hành vi push đã được xác minh ở nơi được hỗ trợ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, firebase, typescript
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100