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

Unsupported operand types when installing a git repo without waiting #99

Closed
dees040 opened this issue Nov 17, 2020 · 1 comment
Closed
Assignees
Labels

Comments

@dees040
Copy link

dees040 commented Nov 17, 2020

  • Forge SDK Version: 3.3.0
  • Laravel Version: 8.14.0
  • PHP Version: 7.4.11
  • Database Driver & Version: mysql version 8.0.21

Description:

When executing the installGitRepositoryOnSite() method and setting the $wait parameter to false the following error is thrown: Unsupported operand types. Thrown in: src/Actions/ManagesSites.php line 188.

The problem is that POST /api/v1/servers/{serverId}/sites/{siteId}/git returns an empty response, causing the $site variable to be "". Then, on line 188 a new Site resource is being created using the union operator: $site + ['server_id' => $serverId]. We can't add an array to a string using the union operator. Also, should it be possible to have a site resource with only the server_id attribute?

I can make a fix, but I'm not sure what the expected behaviour should be. Make another API call to get the site resource? Something like:

$this->post("servers/$serverId/sites/$siteId/git", $data);

if ($wait) {
    return $this->retry($this->getTimeout(), function () use ($serverId, $siteId) {
        $site = $this->site($serverId, $siteId);

        return $site->repositoryStatus === 'installed' ? $site : null;
    });
}

$site = $this->get("servers/$serverId/sites/$siteId");;

return new Site($site + ['server_id' => $serverId], $this);

Steps To Reproduce:

Call the following method:

$forge->installGitRepositoryOnSite(1, 1, false);
@jbrooksuk
Copy link
Member

Thanks for reporting this @dees040. We have fixed this issue within Forge itself by returning the Site data in the response.

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

No branches or pull requests

3 participants