mixpanel-ruby icon indicating copy to clipboard operation
mixpanel-ruby copied to clipboard

Base64 encoding issue

Open EugeneGrigorenko opened this issue 2 years ago • 0 comments

Hi, I'm trying to send a group update message to mixpanel but the group_id key seems to be mishandled on the server side.

I'm calling send! method: Mixpanel::Consumer.new.send!(type, message) type is equal to :group_update and my message looks like this

 {"data": 
   {"$token":"28***90","$time":1697824205638, "$group_key":"zenhub_organization_group_id", 
     "$group_id":"zh-Z2lkOi8vcmFwdG9yL1plbmh1Yk9yZ2FuaXphdGlvbi8yMjkyMw","$set": 
       {"$name":"[email protected]","Stripe Customer ID":"cus_test"}
     }
 }

The group id that I'm using here zh-Z2lkOi8vcmFwdG9yL1plbmh1Yk9yZ2FuaXphdGlvbi8yMjkyMw is a base 64line with a prefix zh-. The encoded value is gid://raptor/ZenhubOrganization/22923. I'm encoding it with Base64.urlsafe_encode64('gid://raptor/ZenhubOrganization/22923', padding: false)

However, once that is sent to Mixpanel it's parsed and displayed as zh-Z2lkOi8vcmFwdG9yL1plbmh1Yk9yZ2FuaXphdGlvbi8yMjkyMw== note the double equals sign at the end of the string.

That doesn't seem to be the case when we send events from the FE with the JS library. Thus creating a mismatch between the group and the events. Any help finding out where the problem lies exactly and finding a potential solution?

EugeneGrigorenko avatar Oct 20 '23 18:10 EugeneGrigorenko