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

Callback called twice on error 413 when using track api

Open RakeshKulangara opened this issue 7 years ago • 4 comments

On the Mixpanel.track eventName, evtData, cb our apps sent huge amount of data inadvertently. That results in error Error 413 (Request Entity Too Large) and the callback above is called twice.

First Callback Error:

Error: Mixpanel Server Error: <!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 413 (Request Entity Too Large)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>413.</b> <ins>That’s an error.</ins>
  <p>Your client issued a request that was too large.
 <script>
  (function() { var c=function(a,d,b){a=a+"=deleted"+("; path="+d);null!=b&&(a+="; domain="+b);document.cookie=a+"; expires=Thu, 01 Jan 1970 00:00:00 GMT"};var g=function(a){var d=e,b=location.hostname;c(d,a,null);c(d,a,b);for(var f=0;;){f=b.indexOf(".",f+1);if(0>f)break;c(d,a,b.substring(f+1))}};var h;if(4E3<unescape(encodeURI(document.cookie)).length){for(var k=document.cookie.split(";"),l=[],m=0;m<k.length;m++){var n=k[m].match(/^\s*([^=]+)/);n&&l.push(n[1])}for(var p=0;p<l.length;p++){var e=l[p];g("/");for(var q=location.pathname,r=0;;){r=q.indexOf("/",r+1);if(0>r)break;var t=q.substring(0,r);g(t);g(t+"/")}"/"!=q.charAt(q.length-1)&&(g(q),g(q+"/"))}h=!0}else h=!1;
h&&setTimeout(function(){if(history.replaceState){var a=location.href;history.replaceState(null,"","/");location.replace(a)}},1E3); })();

</script>
 <ins>That’s all we know.</ins>

Second Callback Error:

{ Error: read ECONNRESET
    at _errnoException (util.js:992:11)
    at TLSWrap.onread (net.js:618:25) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }

Any reason why the Mixpanel library doesn't limit the field length to 255.

RakeshKulangara avatar Aug 07 '18 20:08 RakeshKulangara

Could this be caused by the new enforcement of very specific HTTP rules on Mixpanel's api servers?

austince avatar Aug 15 '18 14:08 austince

We're also facing similar issues. Is there a possibility to get some clarification into this and what the limitation rules are?

JohanBengtsson avatar Nov 16 '18 11:11 JohanBengtsson

For us, it was the content-length of GET requests that our request lib was setting to 2, which the Mixpanel support team helped us figure out, but they were not able to provide a list of specific changes, instead they gave the entire spec.

austince avatar Nov 16 '18 14:11 austince

Happens to us too right now, hard to debug/identify the root cause:(

UPD: figured it out by logging the exact payload that was sent to MP. It was indeed unexpectedly large.

kirillgroshkov avatar Nov 07 '21 16:11 kirillgroshkov