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

Please add trailing slashes to request endpoints in the Android SDK. #764

Closed
elliottj-accolade opened this issue Oct 18, 2021 · 1 comment

Comments

@elliottj-accolade
Copy link

Background: We implemented a proxy service to route our mixpanel calls through using next JS. We found out while using the Mixpanel JS SDK, the client did not receive a response back due to a 308: Permanent Redirect, and because NextJS requires us to specify whether or not we allow trailing slashes, we did not get a response back after the redirect.

The problem: So we added support for trailing slashes to our next.config.js. However, when we did that, the Android library stopped being able to send events to Mixpanel.

After digging around on Github, we found that other Mixpanel libraries have trailing slashes that terminate the request endpoints for track, engage, and groups:
iOS:

enum FlushType: String {
    case events = "/track/"
    case people = "/engage/"
    case groups = "/groups/"
}

JS

...                
events: batcher_for({type: 'events', endpoint: '/track/', queue_suffix: '_ev'}),               
people: batcher_for({type: 'people', endpoint: '/engage/', queue_suffix: '_pp'}),
groups: batcher_for({type: 'groups', endpoint: '/groups/', queue_suffix: '_gr'})

Android does not:

public static final String EVENT = "/track";
public static final String PEOPLE = "/engage";
public static final String GROUPS = "/groups";

We could probably write a workaround for this on the proxy level, but it may be a better solution for Mixpanel's routing to be consistent.

@zihejia
Copy link
Collaborator

zihejia commented Oct 19, 2021

hi @elliottj-accolade , the fix has been included in v5.9.5. Thanks!

@zihejia zihejia closed this as completed Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants