1
votes

after few days of digging on logs, changing repositories and lots of frustration. I'm using rails api hosted on Heroku, vue front-end app also hosted on Heroku.

on authenticate post request from the vue to the rails, the error occurs. I've read this article -

Client Request Interrupted in Heroku

and all the other related articles, yet I've not seen any concrete answer

this.$http.post('/authenticate',{'email':this.user.email,'password':this.user.password},{headers:
    {'Access-Control-Allow-Origin': '*'}}
  ).then((result)=>{
    localStorage.setItem('Authorization',result.data.auth_token);
    this.$http.defaults.headers.common['Authorization'] = localStorage.Authorization;
    this.$router.push('/');
  })
  .catch(error => {
    console.log(error.response);
    alert("Wrong cradentials, if you dont have an account - sign in");
  });

sock=client at=warning code=H27 desc="Client Request Interrupted" method=POST path="/authenticate" host=api-url request_id=9c3016cd-910a-4sd1f-9020-e0asd280e8 fwd="ip" dyno=web.1 connect=2ms service=289ms status=499 bytes= protocol=https

Sometimes the request lands successfully and everything works fine, and sometimes not. about 50\50...

if I log-in then log-out, then again log-in most of the time the problem pop out. sometimes it occurs right away on the first try and on the second it works fine. I've tried to change the parameters that sent tried all the string interpolation variation without any success.

to relate, after the post request sent with the user credentials rails run authenticate methods which confirms the user and sending back auth token as a string.

1
Were you able to resolve this issue or find a cause @Dav k?CanuckT
Yes, apparently I've forgot to prevent the submit button from it's default operation. and therefor while the Js sends ajax request, the form which the submit button was on sends It's own request. Now it was matters of delay. when the js request came first it got interrupted by the form request.Dav k

1 Answers

2
votes

The cause - collision of multiple requests to the server side. apparently I've forgot to prevent the submit button from it's default operation. and therefor while the Js sends ajax request, the form which the submit button was on sends It's own request. Now it was matters of delay, when the js request came first it got interrupted by the form request.