For what reason can an error occur periodically in the client-side? - ruby-on-rails

I have a Rails application that has several components written in Vue. All components are included in the "pack" file.
These two errors occur periodically in the browser (Safari):
SyntaxError: Unexpected token '|'
TypeError: Object(i.a) is not a function. (In 'Object(i.a)()', 'Object(i.a)' is an instance of Object)
The first error points to this line:
<meta name="csrf-token" content="qRbwC3xngly9Y5hRVLA86upHTEkVwIk10PiOtDWCw00RUkIhGK8UvEIhtUXebkzWaqlxsHPSBaheR1moaY-b9w"/>
I don't understand what the second line points to. The error refers to some function "c" in "node.js:15".
Clicking on it jumps to the comment:
In general, I do not understand what it is.
If reload the page, then everything will be fine. Well, that is the problem occurs randomly.
On the Sentry side, I get nothing. Apparently, this does not reach Sentry, the error is not caught and is not transmitted to Sentry.

Related

What does this ejabberd / erlang stack trace mean?

could someone help me figure out what to look for in this stacktrace? I've never touched Erlang, so I don't really know where to start.
We're using v19.09 of ejabberd, and getting this error log for many users:
2020-03-14 15:29:31.096 [error] <0.2029.48>#mod_http_api:handle:257 REST API Error: set_presence([{<<"user">>,<<"53265363">>},{<<"host">>,<<"chat.us.com">>},{<<"resource">>,<<"ssid-3465">>},{<<"type">>,<<"available">>},{<<"show">>,<<"chat">>},{<<"status">>,<<"{\"current_lobby_id\":\"none\",\"status\":\"{\\r\
\\t\\\"rich_presence\\\": \\\"{\\\\r\\\
\\\\t\\\\\\\"rich_presence\\\\\\\": \\\\\\\"?s=PlayerStatusInMap?p0=21?p1=2?p2=3\\\\\\\",\\\\r\\\
\\\\t\\\\\\\"session_id\\\\\\\": \\\\\\\"ssid-3465-38a44f60-9df7-4c79-8c8e-1cc99e5039dd\\\\\\\"\\\\r\\\
}\\\",\\r\
\\t\\\"current_lobby_id\\\": \\\"{\\\\r\\\
\\\\t\\\\\\\"lobby_id\\\\\\\": \\\\\\\"c791cfaa-9fd3-4d0d-9d5c-1aeb9efb12e2#hangouts.chat.us.com\\\\\\\",\\\\r\\\
\\\\t\\\\\\\"privacy\\\\\\\": \\\\\\\"friends_only\\\\\\\"\\\\r\\\
}\\\"\\r\
}\",\"region\":\"\"}">>},{<<"priority">>,<<"0">>}]) -> exit:{noproc,{p1_server,call,[none,{set_presence,{presence,<<>>,available,<<>>,{jid,<<"953265363">>,<<"chat.us.com">>,<<"oak/ssid-3465-1cc99e5039dd">>,<<"1953265363">>,<<"chat.us.com">>,<<"4c79-8c8e-1cc99e5039dd">>},{jid,<<"1953265363">>,<<"chat.us.com">>,<<>>,<<"1953265363">>,<<"chat.us.com">>,<<>>},chat,[{text,<<"en">>,<<"{\"current_lobby_id\":\"none\",\"status\":\"{\\r\
\\t\\\"rich_presence\\\": \\\"{\\\\r\\\
\\\\t\\\\\\\"rich_presence\\\\\\\": \\\\\\\"?s=PlayerStatusInMap?p0=21?p1=2?p2=3\\\\\\\",\\\\r\\\
\\\\t\\\\\\\"session_id\\\\\\\": \\\\\\\"ssid-348c8e-1cc99e5039dd\\\\\\\"\\\\r\\\
}\\\",\\r\
\\t\\\"current_lobby_id\\\": \\\"{\\\\r\\\
\\\\t\\\\\\\"lobby_id\\\\\\\": \\\\\\\"c791cfaa-9fd3-4d0d-9d5c-1aeb9efb12e2#hangouts.chat.us.com\\\\\\\",\\\\r\\\
\\\\t\\\\\\\"privacy\\\\\\\": \\\\\\\"friends_only\\\\\\\"\\\\r\\\
}\\\"\\r\
}\",\"region\":\"\"}">>}],0,[],#{}}},1000]}} [{p1_server,call,3,[{file,"src/p1_server.erl"},{line,210}]},{mod_http_api,handle2,4,[{file,"src/mod_http_api.erl"},{line,267}]},{mod_http_api,handle,4,[{file,"src/mod_http_api.erl"},{line,228}]},{mod_http_api,perform_call,4,[{file,"src/mod_http_api.erl"},{line,188}]},{mod_http_api,process,2,[{file,"src/mod_http_api.erl"},{line,141}]},{ejabberd_http,process,2,[{file,"src/ejabberd_http.erl"},{line,366}]},{ejabberd_http,process_request,1,[{file,"src/ejabberd_http.erl"},{line,488}]},{ejabberd_http,process_header,2,[{file,"src/ejabberd_http.erl"},{line,286}]}]
Start with the actual error, which is buried in the middle:
exit:{noproc,{p1_server,call,[none,{set_presence,.....
So there is a noproc error, which occurred during a call to p1_server:call, where the first argument is none. (The call would look like p1_server:call(none, {set_presence,...}).) That is, we're asking the process called none to execute the command set_presence, which fails because there is no process registered with the name none.
Now let's look at the stack trace. I added line breaks:
[{p1_server,call,3,[{file,"src/p1_server.erl"},{line,210}]},
{mod_http_api,handle2,4,[{file,"src/mod_http_api.erl"},{line,267}]},
{mod_http_api,handle,4,[{file,"src/mod_http_api.erl"},{line,228}]},
{mod_http_api,perform_call,4,[{file,"src/mod_http_api.erl"},{line,188}]},
{mod_http_api,process,2,[{file,"src/mod_http_api.erl"},{line,141}]},
{ejabberd_http,process,2,[{file,"src/ejabberd_http.erl"},{line,366}]},
{ejabberd_http,process_request,1,[{file,"src/ejabberd_http.erl"},{line,488}]},
{ejabberd_http,process_header,2,[{file,"src/ejabberd_http.erl"},{line,286}]}]
The first line is where it discovers that there is no such process, on line 210 in p1_server.erl. But we're more interested in why we're passing none as the argument in the first place. The stack trace suggests that's happening somewhere in mod_http_api.erl, but at that point I'm getting lost - it seems like it's extracting the arguments from the command, but I don't understand where the none is coming from...

Ruby on Rails jsonparse error

Already I have spent a lot time to resolve the issue but not getting the actual reason.
I have a issue during parsing the json, below is the my josn which i am trying to format.
ERROR: 757: unexpected token at '"{\"requestId\":\"2323423432\",\"bids\":\"[ {\\"adId\\":50000001, \\"bidNative\\":100,\\"clickPayload\\":\\"clickPayload-1\\", \\"impressionPayload\\":\\"236|458795|12345\\"}, {\\"adId\\":60000002, \\"bidNative\\":200,\\"clickPayload\\":\\"clickPayload-2\\", \\"impressionPayload\\":\\"236|458795|12345\\"}, {\\"adId\\":60000002, \\"bidNative\\":300,\\"clickPayload\\":\\"clickPayload-3\\", \\"impressionPayload\\":\\"236|458795|12345\\"}]\"}"'
actually wherever it shows 2 slashes there are actually 3, but i dont know why stack overflows editor shows like this.

Calling .trigger('create') causes JavaScript error

I have this weird issue with jQuery Mobile that only occurs on page refresh (e.g. by pressing F5).
On the page in question, within the 'pageshow' event, the following is called:
$('content').html(details.html).trigger('create');
This works perfectly fine when the page is navigated to, but once you stay on the page and refresh, the styles aren't applied and the following error appears in the JS console:
TypeError: c[0] is undefined
However, if I push the .trigger('create') into a setInterval with a value of 1, it still throws the error but applies the styles correctly:
$('content').html(details.html);
setInterval(function() {
$('content').trigger('create');
}, 1);
Obviously this isn't ideal, so I was wondering if anyone has come across a similar problem, and if so what they did to fix it?

Reconcile Error: Has anyone had problems with truncated error messages?

I'm here again to ask for a help to you. This time I believe that few will respond given the great particularity of the problem which I will relate. I'm starting in the world of DataSnap, and still have things I do not understand how this error I will relate.
My Delphi is XE (version 1, Update1). I am using Postgres which generates error messages in Portuguese (Portuguese Brazil) and for this reason the error messages have accents. The connection components are ZeosLib package.
I am using a dialog box "reconcile error" to display errors arising from the application of updates and to test, I tried to insert a record that already existed, thus violating a unique key and thus displaying the reconcile error dialog.
In the memo of the dialog, the message that appears is truncated, ie cut. Check it out:
ERRO: duplicar valor da chave viola a restrição de unicidade "uc_usu_va_login"
DETAIL: Chave (va_login)=(admin) já existe.
CONTEXT: comando SQL "INSERT INTO USUARIOS (VA_NOME
,VA_LOGIN
,CH
But actually what should be returned is this:
ERRO: duplicar valor da chave viola a restrição de unicidade "uc_usu_va_login"
DETAIL: Chave (va_login)=(admin) já existe.
CONTEXT: comando SQL "INSERT INTO USUARIOS (VA_NOME
,VA_LOGIN
,CH_SENHA
,VA_EMAIL)
VALUES (pVA_NOME
,pVA_LOGIN
,pCH_SENHA
,pVA_EMAIL)"
PL/pgSQL function "idu_usuarios" line 7 at comando SQL
I have done a debug on the server to see if the problem is ZeosLib, but I found that the error message generated on the server is complete, proving that ZeosLib does not truncate the message. Everything is unicode. All strings are WideString (the default) on both my program and in ZeosLib.
As you know, to be thrown on the server, the exception is forwarded to the client, roughly speaking, by DataSnap, and on the client, the Reconcile method of TClientDataSet verify if there were problems and then throw the famous exception EReconcileError that can be handled in the OnReconcileError event of TClientDataSet, therefore I believe that the message is being truncated by DataSnap.
On the client I debug the Reconcile method (DBClient.pas) and immediately before the exception is thrown the flow enters a function within a cpp source code that I think part of the library midas.dll, MidasLib.obj more specifically, since I am using this strategy, not to have to distribute the DLL with my application.
Check(FDSBase.Reconcile_MD(FReconcileDataSet.FDSBase, FDeltaPacket, VarToDataPacket(Results), Integer(Self), RCB));
This call is done at line 1952 of the unit DBClient.pas on Delphi XE Update1. Pressing F7, the debugger enters a source C++ (cpp), so I believe it is within the midaslib.obj. How I do not understand C++ well, I press Shift-F8 to exit the current method and return the next instruction, that is already inside the event OnReconcileError!! Therefore, the truncation must be done within the function I mentioned, within a cpp source, within midaslib.
My intention is to make the Reconcile Error dialog a tool not only for the final user but to support personals, providing separately information of Error, Details and Context. This helps a lot to discover a problem.
The problem now is to make the message appear in full. Has anyone had this kind of problem with messages being truncated by midas?
Also another point DSClient.pas I could extract the error message as it is passed to the exception:
'Erro SQL: ERRO: duplicar valor da chave viola a restrição de unicidade "uc_usu_va_login"'#$A'DETAIL: Chave (va_login)=(admin) já existe.'#$A'CONTEXT: comando SQL "INSERT INTO USUARIOS (VA_NOME'#$A' ,VA_LOGIN'#$A' ,CH'
If you remove the quotes and replace #$A (1 character) by a white space (one character), you will see that the string has exactly 255 characters!!
I also discovered that the "GetErrorString" in dspickle.cpp uses the constant DBIMAXMSGLEN which is defined in bdetypes.h as 127 (half of 255). As we are in the world of Unicode, it would not be a question of increasing this value to 255 in order to have two bytes per character? This is only a guess...
I leave the question in the air because I lack the knowledge to understand C++ :) Who can help, just look at the function implementation "GetErrorString" in dspickle.cpp. There is this:
LoadString((HINSTANCE)hDll, iErrCode, pString, DBIMAXMSGLEN)
pString is the error message and DBIMAXMSGLEN = 127.
Contradicting the opinion of others I decided to tweak further and finally figured out how to increase the number of characters in the "Reconcile" error message. As I thought the problem was in midas.dll, or more specifically the sources that make up the midas dll because the same set of sources can create MidasLib, which does not require a midas dll. To resolve I had to install the Delphi C++ personality to compile the midas.
After finding the line of the error, I discovered that there is even a request for repairs to the QC (http://qc.embarcadero.com/wc/qcmain.aspx?d=84960) which seems to have been ignored by the staff of Embarcadero, as that the "Resolution" as is "Deferred to Next Rel" (Deferred to Next Release) but the request is from 2010 and I'm using Delphi XE which in my opinion should have the solution but here I am correcting by myself ;)
The problem is inside the method "Clone" of the "DSBASE" class, inside source "ds.cpp" at line 2133 (Delphi XE, Update1). Below is the code block. The red line is the problematic line:
// Set the third field for the error string.
LdStrCpy((pCHAR)pFldDes->szName, szdsERRMESSAGE);
pFldDes->iFldType = fldZSTRING;
pFldDes->iUnits1 = 255; // Increased on request.. DBIMAXMSGLEN;
pFldDes++;
Note that it is very interesting the problem line. It has a constant value of 255, which limits the size of the error messages and a comment "Increased on request". Also note that next to the comment, there is a constant DBIMAXMSGLEN, which I had found and already suspected as being responsible for the problem, but as it was not being used I changed the value of DBIMAXMSGLEN but the error message always came without changes. It is worth mentioning that there is a semicolon (;) after DBIMAXMSGLEN which leads me to think that before (I do not know when) this line was one that was just after my fix:
pFldDes->iUnits1 = DBIMAXMSGLEN;
It's as if someone had deliberately set the field value to 255, removing the previous implementation that was really dynamic and seemingly more correct. After performing the replacement of the line I increased the value of DBIMAXMSGLEN to 1024. DBIMAXMSGLEN is declared "bdetypes.h" as a define. After correcting the line went like this:
#define DBIMAXMSGLEN 1024 // Max message len
After these two changes in "ds.cpp" and "bdetypes.h" I build, test, and the result was as expected: the error message was presented in full in the Reconcile dialog.
To the brave who want to try if they have seen this problem, you need the sources of MIDAS, which comes with Delphi from 2010 if I remember correctly. Good luck to all.

Get "Response code = 500" error randomly when running cucumber

For some reason I keep getting a response code of 500 when I run cucumber, even though all the tests pass. The error occurs randomly for different tests, every time I run it. Sometimes all tests pass as well.
I thought it was a memory issue, so I tried restarting my computer, but that didn't do anything.
An example of the error is:
And I follow "link" # features/step_definitions/web_steps.rb:33
Failed. Response code = 500. Response message = Internal Server Error. (ActiveResource::ServerError)
./app/controllers/companies_controller.rb:23:in `show'
./features/step_definitions/web_steps.rb:35
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:34:in `/^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/'
features/manage_sites.feature:256:in `And I follow "link"'
It seems related to the tagging feature. I was using the #wip tag, and when I moved it around, it would cause the sporadic 500 errors. Removing all #wip tags makes all the tests pass.
I could be wrong though. I'll need to try and replicate it consistently.
Would anybody be able to help?

Resources