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

Events not showing up when migrating to latest Amplitude-Swift 1.7.0 #200

Closed
bharath-kamath opened this issue Jul 25, 2024 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@bharath-kamath
Copy link

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

  • Migrated from Amplitdue-iOS (4.6.0) to AmplitudeSwift (1.7.0)
  • Run the app, start logging events
  • Events not showed on dashboard or being flushed from simulator.

let configuration = Configuration(
apiKey: "MY-API-KEY",
logLevel: LogLevelEnum.DEBUG,
defaultTracking: DefaultTrackingOptions(
sessions: true,
appLifecycles: true,
screenViews: false
)
)

Environment

  • SDK Version: 1.7.0
  • OS Info: iOS 17.0, Xcode 15.0.1
@bharath-kamath bharath-kamath added the bug Something isn't working label Jul 25, 2024
@crleona
Copy link
Collaborator

crleona commented Jul 25, 2024

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.

@bharath-kamath
Copy link
Author

Thanks for your response, checking the result there its throwing a 400 error.

The operation couldn’t be completed. (AmplitudeSwift.HttpClient.Exception error 1.)

@crleona
Copy link
Collaborator

crleona commented Jul 29, 2024

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.

@bharath-kamath
Copy link
Author

Screenshot 2024-08-06 at 7 22 55 PM

This is what I'm seeing, anything else you suspect might be wrong?

@crleona
Copy link
Collaborator

crleona commented Aug 10, 2024

@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).

@bharath-kamath
Copy link
Author

bharath-kamath commented Aug 12, 2024

@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.

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

No branches or pull requests

2 participants