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

Connection refused on $currentUser->fetch() #457

Open
YousefAlsbaihi opened this issue Dec 15, 2019 · 1 comment
Open

Connection refused on $currentUser->fetch() #457

YousefAlsbaihi opened this issue Dec 15, 2019 · 1 comment

Comments

@YousefAlsbaihi
Copy link

YousefAlsbaihi commented Dec 15, 2019

Issue Description

i'm updating user informations using Parse PHP SDK the connection is 100% correct and established, i'm able to update other classes and everything fine, the problem is, when trying to update the user informations if there is error i'm doing $currentUser->fetch() which will get the current user informations without updating them incase there is error occur, and it throw the error below.

NOTE: The IP address in here is just dummy i didn't share the real one with this question.

Steps to reproduce

 <?php
    require 'vendor/autoload.php';
    use Parse\ParseObject;
    use Parse\ParseQuery;
    use Parse\ParseACL;
    use Parse\ParsePush;
    use Parse\ParseUser;
    use Parse\ParseInstallation;
    use Parse\ParseException;
    use Parse\ParseAnalytics;
    use Parse\ParseFile;
    use Parse\ParseCloud;
    use Parse\ParseClient;
    use Parse\ParseSessionStorage;
    //use Parse\ParseQuery;

    session_start();

    Parse\ParseClient::initialize( 'HostAppId', 'HostRest', 'HostAppMaster');
    Parse\ParseClient::setServerURL('http://1.1.1.1:1337/parse','/host');
    //Parse\ParseClient::setHttpClient(new Parse\ParseCurlHttpClient());
    $currentUser = Parse\ParseUser::getCurrentUser();

    $currentUser->set("email", $email);
    $currentUser->set("name", $name);
    $email = "[email protected]";
    $name = "Name ";
    try {
        $currentUser->save();
        echo "OK";
    } catch (Parse\ParseException $er) {
        $ex = $er->getMessage();
        echo $ex;
        $currentUser->fetch(true);

    }`
### Environment Details

- Your PHP Version: **7.0.31**
- Your Parse PHP SDK Version: **1.5.***
- Your Operating System: **onCatalina v 10.15.1**

### Logs/Traces

`Account already exists for this email address.<br /> <b>Fatal error</b>: Uncaught 
Parse\ParseException: Failed to connect to 1.1.1.1 port 1337: Connection refused in 
/Users/yousefalsbaihi/Desktop/HOST/vendor/parse/php-sdk/src/Parse/ParseClient.php:584 Stack 
trace: #0 /Users/yousefalsbaihi/Desktop/HOST/vendor/parse/php-sdk/src/Parse/ParseObject.php(540):
 Parse\ParseClient::_request('GET', 'classes/_User/e...', 'r:6347ca34fba62...', NULL, true) #1 
/Users/yousefalsbaihi/Desktop/HOST/functions/update_user.php(35): Parse\ParseObject-
&gt;fetch(true) #2 {main} thrown in <b>/Users/yousefalsbaihi/Desktop/HOST/vendor/parse/php-
sdk/src/Parse/ParseClient.php</b> on line <b>584</b><br />`

```
@davimacedo
Copy link
Member

Parse\ParseClient::setServerURL('http://1.1.1.1:1337/parse','/host'); looks strange to me. Shouldn't it be Parse\ParseClient::setServerURL('http://1.1.1.1:1337,'/parse);?

Can you please also double check your master key? What happens if you try $currentUser->fetch();?

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

3 participants