Skip to content

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

Closed
@elliottj-accolade

Description

@elliottj-accolade

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions