Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post not working on WebGL compilation #233

Open
MagusDrk opened this issue Nov 30, 2022 · 3 comments
Open

Post not working on WebGL compilation #233

MagusDrk opened this issue Nov 30, 2022 · 3 comments

Comments

@MagusDrk
Copy link

Hello.

I have a post implementation wich works correctly from que unity editor, but when I build and run the project in WebGL, I receive a message : "Proyecto26.RequestException: Unknown Error" but I can't figure out wich is the reason.

Code fragment:

public static void SaveDatabase(){
RestClient.Post("https://my-project.firebaseio.com/users/.json", GameInfo.info)
.Then(response =>
Debug.Log("Información del jugador guardada exitosamente: " + JsonUtility.ToJson(response, true))
)
.Catch(error =>
{
Debug.LogError("Error guardando la información del jugador: "+ error.Message);
}
);
}

GameInfo.info is a DTO object with a serialization toString method wich converts the content to json.

The error logged from the catch:
image

Please, let me know wich extra information could be required to resolve this issue. Any help will be very appreciated.

@HtDreams
Copy link

HtDreams commented Mar 7, 2023

Hi,

I have the same problem, requesting a GET<Models.ResponseGallery> it returns "UNKNOWN ERROR" which doesn't tell anything usefull to search for solutions :-)

It only fails when called from WEBGL, from unity editor or standalone/mobile it works fine

[Serializable]
public class Media 
{
    public int id;
    public int story_id;
    public string stage;
    public string title;
    public string media_type;
    public string media_file;
    public bool force_page;
    public DateTime created;
    public DateTime modified;
}
[Serializable]
public class ResponseGallery : Response
{
    public Media[] data;
}

Request: {
"Uri": "https://SERVERADDRESSHIDDEN/api/stories/10/gallery/",
"Method": "GET",
"Body": {
"stage": "",
"text": ""
},
"BodyString": null,
"BodyRaw": null,
"Timeout": null,
"ContentType": null,
"Retries": 0,
"RetrySecondsDelay": 0.0,
"RetryCallbackOnlyOnNetworkErrors": true,
"RetryCallback": null,
"ProgressCallback": null,
"EnableDebug": true,
"UseHttpContinue": true,
"RedirectLimit": null,
"IgnoreHttpException": false,
"FormData": null,
"SimpleForm": null,
"FormSections": null,
"CertificateHandler": null,
"UploadHandler": null,
"DownloadHandler": null,
"Headers": [
{
"Key": "Authorization",
"Value": "Bearer lWnJvilJmJUuru9gzlaOznnDAuFoze"
}
],
"Params": [],
"ParseResponseBody": true,
"UploadProgress": 0.0,
"UploadedBytes": 0,
"DownloadProgress": 0.0,
"DownloadedBytes": 0,
"IsAborted": false,
"DefaultContentType": true
}

@NullOne01
Copy link

Could you send stacktrace of the error? Maybe it can help

You can turn it on in Project Settings > Player > Publishing Settings > Enable Exceptions.
image

@MeltdownInteractive
Copy link

MeltdownInteractive commented Feb 25, 2024

For anyone wondering if this is an issue with this asset, it is not.
I created a new project in Unity 2021.3.27f1, using RestClient v2.6.2, and could run the GET and POST commands from the Demo scene without any issues.

Get Test
image

Post Test
image

Would recommend closing this issue, as it doesn't seem specific to this asset or WebGL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants