Issues with cloudsave

Discussion and help for Easy Save 3
Post Reply
krolldk
Posts: 25
Joined: Sun Jun 02, 2019 11:15 am

Issues with cloudsave

Post by krolldk »

Hi

I'm having a number of problems with cloudsave:

Issue1: Installing.
I dropped the ES3Cloud.php script in my webserver in a subdirectory. I follow the steps described in documentation. ES3Cloud fails to create variables.php, and fails to write what should be IN the ES3Variables file. I can only see that, by looking at the page source of the error page I get. I create a ES3Variables.php file with the following content:

Code: Select all

<?php
$api_key		=	'secretsecret';		// The API key you need to specify to use when accessing this API.

$db_host		= 	'mysql26.secretsecret.com';		// MySQL Host Name.
$db_user		= 	'myUser';		// MySQL User Name.
$db_password		= 	'myPass';	// MySQL Password.
$db_name		= 	'myDB_db';		// MySQL Database Name.
?>
presumably, this should conclude the installation ? The database has a new table in it, which is empty, I guess as expected ?
What I'd like: A way to test that the installation went well: I'd like to see the php script tell me that everything is fine. Right now, because I had to do manual stuff, I do not trust that the installation went well.

Issue 2: Actually saving something, and loading it too.

Code: Select all

    IEnumerator TestCloud()
    {
        var cloud = new ES3Cloud("http://mydomain/data/ES3Cloud.php", "myapikey");  //this line redacted for secredy, but values are trippled checked and correct

        var es3File = new ES3File("MyFile.es3");
        es3File.Save<int>("myOtherInt", 7);

        yield return StartCoroutine(cloud.Sync("MyFile.es3"));
        if (cloud.isError)
        {
            Debug.LogError(cloud.error);
        }
        yield return StartCoroutine(cloud.Sync("MyFile.es3"));
        if (cloud.isError)
        {
            Debug.LogError(cloud.error);
        }
        int myOtherInt = es3File.Load<int>("myOtherInt");
        print("Loaded " + myOtherInt);
    }
the above gives me the error:

Code: Select all

<h1>Security incident detected</h1><p>Your request was blocked. Please try again later (or don't).</p>
UnityEngine.Debug:LogError(Object)
<TestCloud>c__Iterator0:MoveNext() (at Assets/_Scripts/Cloud/CloudHandler.cs:29)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
Which I assume is thrown by my webserver, not by ES3Cloud.php ?

If I direct a browser at http://mydomain/data/ES3Cloud.phpabove, I get "wrong API key" , Which I think IS thrown by ES3Cloud.php ?

If I change http above to https I get instead "unknown error". (there is no ssl certificate on the webadress, so I WOULD expect https to fail, but tried it anyway).

What am I doing wrong? There's some issue with the webserver setup right ? Can I test the setup somehow ?
krolldk
Posts: 25
Joined: Sun Jun 02, 2019 11:15 am

Re: Issues with cloudsave

Post by krolldk »

Also ....
Why, in the documentation, are the code examples something like:

Code: Select all

// Create a new ES3Cloud object with the URL to our ES3.php file.
var cloud = new ES3Cloud("http://www.myserver.com/ES3.php", "myAPIKey");
 
when the default ES3 php script is called ES3Cloud.php ? Shouldn't the above rather be

Code: Select all

// Create a new ES3Cloud object with the URL to our ES3.php file.
var cloud = new ES3Cloud("http://www.myserver.com/ES3Cloud.php", "myAPIKey");
 
?
krolldk
Posts: 25
Joined: Sun Jun 02, 2019 11:15 am

Re: Issues with cloudsave

Post by krolldk »

OK Got it now. I think.

First of all, my webserver firewall dislikes ES3Cloud.php, so I had to punch a hole in the firewall. Not crazy about it, but there you go, and not Moodkies fault.

Secondly: My script:

Code: Select all

        var cloud = new ES3Cloud("http://spildramadronning.dk/ES3Cloud.php", "03dc19321416");

        var myFile = new ES3File("myGlobalFile.es3");

        myFile.Save<int>("myInt", 3);
        myFile.Sync();  //Without this line, nothing happens in the next line. This is very unclear from documentation. 

        yield return StartCoroutine(cloud.Sync("myGlobalFile.es3"));

        if (cloud.isError)
            Debug.LogError(cloud.error);

See comment in code. that took me a while to figure out.
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Issues with cloudsave

Post by Joel »

Hi there,

Glad you managed to find a solution to the issue.

The Sync() line is only required because you're loading the data from storage, rather than providing the ES3File as a parameter to the cloud.Sync method.

ES3.php is used in the examples because in earlier versions this name was used. However, we changed it to be clearer, but we don't seem to have updated the example. I'll fix that now.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
krolldk
Posts: 25
Joined: Sun Jun 02, 2019 11:15 am

Re: Issues with cloudsave

Post by krolldk »

OK. It makes a lot of sense to be able to upload/download files without having to have local files on disk.

However, as far as I can see, ES3Cloud.Sync does not exist in a version that accepts an ES3file as a parameter ? Did you mean ES3Cloud.UploadFile() ? And ES3DownloadFile() for download ?
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Issues with cloudsave

Post by Joel »

My apologies, this is indeed what I meant :)

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
krolldk
Posts: 25
Joined: Sun Jun 02, 2019 11:15 am

Re: Issues with cloudsave

Post by krolldk »

OK ... more issues with cloudsave.

I'm saving a file using code like this :

Code: Select all

ES3File saveManus = new ES3File("Foo");
saveManus.Save<string>("manus", manusAsJSON);
yield return StartCoroutine(cloud.UploadFile(saveManus));
if (cloud.isError)
        {
            Debug.Log("save failed : "+ manuscriptID);
        }
I get no errors, and I can see the file on my database. Only weird thing about the file is, that the "lastupdated" field is 0. I think thats a timestamp right ?

Loading the file:

Code: Select all

        ES3File loadManus = new ES3File("Foo");
        yield return StartCoroutine(cloud.DownloadFile(loadManus));
        while(!cloud.isDone)
        {
            yield return new WaitForEndOfFrame();
        }
        if (cloud.isError)
        {
            Debug.Log("load failed : " + cloud.error);
        }

yields "Load failed : File Foo was not found on the server"

So .. what gives ? no error on saving, there's a record on the DB (and the content looks right) but on downloading, Easy save can't find the file ?
krolldk
Posts: 25
Joined: Sun Jun 02, 2019 11:15 am

Re: Issues with cloudsave

Post by krolldk »

OK Update :

After manually changing the lastupdate field in the database to some high random number, I could apparently load the file. So. What gives ?
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Issues with cloudsave

Post by Joel »

Hi there,

I have replicated this at my end and will PM you over an update.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
krolldk
Posts: 25
Joined: Sun Jun 02, 2019 11:15 am

Re: Issues with cloudsave

Post by krolldk »

thanks fr the patch. sadly, still seem broken. PMed you
Post Reply