Closed bharath-kamath closed 3 weeks ago
Hi @bharath-kamath - This can be the expected behavior, especially if a lot of events have been queued on the device before uploading. Events are logged to file, then each file is uploaded independently, but we keep track of which files are currently in flight and skip them on subsequent flushes. It's also possible that some of the events are malformed, which would cause retries for many of them. We expect this to eventually resolve as the uploads complete, but new events may be delayed until prior events are uploaded.
Admittedly the logging here could be improved, but setting a breakpoint / adding some logging of the result in EventPipeline.swift:75
should give you some visibility if any errors are occurring on upload.
Thanks for your response, checking the result there its throwing a 400 error.
The operation couldn’t be completed. (AmplitudeSwift.HttpClient.Exception error 1.)
Are you able to provide any more information on the error you are seeing? If you are seeing a 4xx response error, I would expect that the exception would return the specific error code, not 1.
This is what I'm seeing, anything else you suspect might be wrong?
@bharath-kamath ,
Could you set a breakpoint at HttpClient:41
and inspect the contents of data, response, error
? You should be able to read data by calling po String(data: data!, encoding: .utf8)
. (Sorry, improved logging is on our radar).
@crleona Thanks, that helped.
I thought I had double checked this but it seems the error is Invalid API key
.
Updating the error messaging will help, invalid api key should probably be more easily flagged to users.
We have migrated our iOS app from the old sdk to the latest AmplitudeSwift sdk and the events no longer show up on the dashboard. After enabling the debug logging, we see that that flush events are failing.
Debug: Skipping migrateInstanceOnlyStorages based on STORAGE_VERSION
Debug: Installing NetworkConnectivityCheckerPlugin, offline feature should be supported.
Log: Start flushing 2 events
Log: Start flushing 30 events
Log: Existing upload in progress, skipping...
Log: Existing upload in progress, skipping...
Log: Existing upload in progress, skipping...
Log: Existing upload in progress, skipping...
Log: Existing upload in progress, skipping...
Log: Existing upload in progress, skipping...
Log: Start flushing 30 events
We just see thousands of the same “Existing upload in progress, skipping” and “start flushing” over and over again.
Any thoughts on why the flush is not successful?
Expected Behavior
Events get flushed and start appearing in the dashboard.
Current Behavior
After 30 events are reached, events are not flushed hence subsequent events are not captured.
Steps to Reproduce
let configuration = Configuration( apiKey: "MY-API-KEY", logLevel: LogLevelEnum.DEBUG, defaultTracking: DefaultTrackingOptions( sessions: true, appLifecycles: true, screenViews: false ) )
Environment