Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to send events in widget extension #468

Open
IlyaSirosh opened this issue Nov 1, 2023 · 2 comments
Open

Failed to send events in widget extension #468

IlyaSirosh opened this issue Nov 1, 2023 · 2 comments
Labels
bug Something isn't working feature request

Comments

@IlyaSirosh
Copy link

Hello,
I have an issue with sending events from widget extension.
I've tried following options:

  1. Updated to the latest version of SDK (from v4.10.0 to v8.17.2)
  2. Force events sending with Amplitude.instance(withName: "widgets").uploadEvents()
  3. Send events with API (batch operation) and wait for response before returning timeline in Provider.getTimeline(...)
  4. Also I've tried to use the newest SDK for Amplitude: Amplitude-Swift v1.1.0 -- it isn't support to be used in app extensions

Appreciate any help or advice

Expected Behavior

Event should be sent via SDK

Current Behavior

Getting error in console while SDK tries to send event:
ERROR: Connection error:Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=57, NSUnderlyingError=0x147f0bf50 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=57, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <E4CEB02E-270B-420A-88F5-82F6A4AB6DFF>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <E4CEB02E-270B-420A-88F5-82F6A4AB6DFF>.<1>" ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://api.amplitude.com/, NSErrorFailingURLKey=https://api.amplitude.com/, _kCFStreamErrorDomainKey=1}

Or with API calls:

Task <5EF7A32F-D407-41BE-A8E4-B38A9CC8A9A0>.<1> finished with error [18 446 744 073 709 550 619] Error Domain=NSURLErrorDomain Code=-997 UserInfo={NSErrorFailingURLStringKey=<private>, NSErrorFailingURLKey=<private>, _NSURLErrorRelatedURLSessionTaskErrorKey=<private>, _NSURLErrorFailingURLSessionTaskErrorKey=<private>, NSLocalizedDescription=<private>}

I have to mention that network conditions is actually fine and events can be successfully sent from application, but widget extension.

Possible Solution

Steps to Reproduce

  1. Install application
  2. Kill application (in order to run only widget extension process)
  3. Add widget (event is triggered on getting timeline)

Environment

  • SDK Version: v8.17.2, v4.10.0
  • Device: iPhone 14 pro
  • OS Version: iOS 17.0.2
@IlyaSirosh IlyaSirosh added the bug Something isn't working label Nov 1, 2023
@Mercy811
Copy link
Contributor

Mercy811 commented Nov 6, 2023

Hi @IlyaSirosh, thanks for choosing Amplitude.

Were you using the this batch API? I would suggest to use the HTTP V2 API which is the endpoint the Swift SDK is using.

Currently we don't support sending events in widget extension. I added a feature request label and put this to our backlog. But we don't have an ETA for this feature due to the high volume of support tickets. We can help to merge in if you have a PR to add this feature.

Hope it helps.

@IlyaSirosh
Copy link
Author

Hi @Mercy811, thank you for response and advice.

Indeed I've made a workaround with batch API and background URL session. Works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature request
Projects
None yet
Development

No branches or pull requests

2 participants