"An error occurred"...
 
Notifications
Clear all

"An error occurred" when trying to create a group

6 Posts
3 Users
0 Reactions
1,242 Views
(@tommih)
Posts: 44
Trusted Member
Topic starter
 

Hello.

Recently (possibly after the latest patch), we're no longer able to create new groups. When trying, we get the mysterious "An error occurred". Any idea what might have happened, or how to investigate this? Here is an example of a failing request. I know you can't debug it on our server, but you should be able to tell, at least, what kind of command exactly I'm using.

http://wolfquest.org/combu/groups.php?UID=50&UGUID=58c00f2aeb3817.83523885&action=save&Id=0&Name=testitespack&CustomData=%7b%7d&Username=&sig_time=636245822172472460&sig_crc=be5e77c5195aae992d5bf2e576b7a150a3492a27

 
Posted : 09/03/2017 4:02 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

Since I don't know what version you're using, I'll assume you're on 2.x. If you look at the function wsSave in /groups.php you'll see that this string is sent when the method Save of CB_UserGroup fails, so the easiest way is to temporarily edit /lib/CB_UserGroup.php and add the following inside the method Save (right before the call to $Database->Query):

AppLog::Info($query);

and in the lines below (right before "return FALSE"):

AppLog::Error($Database->GetError());

Then try to save the group in your Unity client and check the log file on your webserver to read the SQL query it's trying to execute and eventually the MySql error received (you can try to execute the query yourself in phpMyAdmin if the log doesn't show any error).

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 09/03/2017 5:18 pm
(@gecko64)
Posts: 82
Estimable Member
 

We're using 2.2.1

So here is this part of the edited code--is this correct?

 

} else {
$query = sprintf("INSERT INTO %s (Name, IdOwner, Public, CustomData) VALUES ('%s', %d, %d, '%s')",
self::GetTableName(__CLASS__),
$Database->Escape($this->Name),
$this->IdOwner,
$this->Public,
$Database->Escape($this->CustomData));
AppLog::Info($query);
}
if ($Database->Query($query)) {
if ($this->Id < 1)
$this->Id = $Database->InsertedId();
return TRUE;
}
return FALSE;
AppLog::Error($Database->GetError());
}

 

I uploaded the file to the server, and now I get these errors in Unity when I try to create a group:

 

Error creating pack: An error occurred
UnityEngine.Debug:LogError(Object)
CombuAccountRoot:HandleGenericError(String, String, Boolean) (at Assets/0 Game Assets/Scripts/User Accounts/CombuAccountRoot.cs:98)
CombuPacks:<CreatePack>m__83(Boolean, String) (at Assets/0 Game Assets/Scripts/User Accounts/CombuPacks.cs:370)
Combu.<Save>c__AnonStorey14A:<>m__FD(String, String) (at Assets/Combu/Scripts/UserGroup.cs:210)
Combu.<DownloadUrl>c__Iterator98:MoveNext() (at Assets/Combu/Scripts/CombuManager.cs:424)

Error creating pack: An error occurred
UnityEngine.Debug:LogError(Object)
CombuAccountRoot:HandleGenericError(String, String, Boolean) (at Assets/0 Game Assets/Scripts/User Accounts/CombuAccountRoot.cs:112)
CombuPacks:m__83(Boolean, String) (at Assets/0 Game Assets/Scripts/User Accounts/CombuPacks.cs:370)
Combu.c__AnonStorey14A:<>m__FD(String, String) (at Assets/Combu/Scripts/UserGroup.cs:210)
Combu.c__Iterator98:MoveNext() (at Assets/Combu/Scripts/CombuManager.cs:424)

 
Posted : 09/03/2017 6:29 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

It's not correct, here is:

AppLog::Info("SAVE GROUP: " . $query);
if ($Database->Query($query)) {
   if ($this->Id < 1)
      $this->Id = $Database->InsertedId();
   return TRUE;
}
AppLog::Error("MYSQL ERROR: " . $Database->GetError());
return FALSE;

And then you should look at the log file (not Unity log, but the log file on your web server, by default it should be /_logs/applog.log) after you get the error in Unity, and if the log file doesn't contain anything after "MYSQL ERROR:" then you should try to execute in phpMyAdmin the query you see after "SAVE GROUP:".

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 09/03/2017 6:43 pm
(@gecko64)
Posts: 82
Estimable Member
 

Thanks, but I still did something wrong. (I could wait until my server guy can do this, but I'm hoping to fix it right away.) I made that edit but then get this error, so obviously screwed it up again:

 

Error logging in: 503 Service Unavailable
UnityEngine.Debug:LogError(Object)
CombuAccountRoot:HandleGenericError(String, String, Boolean) (at Assets/0 Game Assets/Scripts/User Accounts/CombuAccountRoot.cs:112)
CombuLoginAndRegister:<Login>m__54(Boolean, String) (at Assets/0 Game Assets/Scripts/User Accounts/CombuLoginAndRegister.cs:496)
Combu.<DoAuthenticate>c__AnonStorey12F:<>m__E2(String, String) (at Assets/Combu/Scripts/User.cs:137)
Combu.<DownloadUrl>c__Iterator98:MoveNext() (at Assets/Combu/Scripts/CombuManager.cs:424)

Can you tell me what to paste in for this entire chunk?

 

public function Save() {
global $Database;
if ($this->Id > 0) {
$query = sprintf("UPDATE %s SET Name = '%s', IdOwner = %d, CustomData = '%s' WHERE Id = %d",
self::GetTableName(__CLASS__),
$Database->Escape($this->Name),
$this->IdOwner,
$Database->Escape($this->CustomData),
$this->Id);
} else {
$query = sprintf("INSERT INTO %s (Name, IdOwner, Public, CustomData) VALUES ('%s', %d, %d, '%s')",
self::GetTableName(__CLASS__),
$Database->Escape($this->Name),
$this->IdOwner,
$this->Public,
$Database->Escape($this->CustomData));
}
AppLog::Info("SAVE GROUP: " . $query);
if ($Database->Query($query)) {
   if ($this->Id < 1)
      $this->Id = $Database->InsertedId();
   return TRUE;
}
AppLog::Error("MYSQL ERROR: " . $Database->GetError());
return FALSE;
}

/**
* Delete the record from the database
*
* @return bool Returns TRUE on success
*/
public function Delete() {
if ($this->Id < 1)
return FALSE;
if ($this->_Delete(self::GetTableName(__CLASS__), "Id = " . $this->Id)) {
// Delete all memberships
$this->_Delete(self::GetTableName("CB_UserGroupAccount"), "IdGroup = " . $this->Id);
// Delete all messages
$this->_Delete(self::GetTableName("CB_Mail"), "IdGroup = " . $this->Id);
return TRUE;
}
return FALSE;
}

 
Posted : 09/03/2017 7:06 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

The syntax looks correct, but what is the version you're using? 2.2.1 doesn't exist... the latest stable is 2.1.14 and I'm having no issues in creating group on a fresh installation of 2.1.14, may be I'll need to access your web server through FTP and try to see what's happening there, please contact me by PM so we can schedule a text chat on Skype.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 09/03/2017 7:36 pm
Share: