<p>I was able to resolve this issue by reimporting the database.</p>

CC BY-SA 4.0
2019-01-31T23:10:51.357Z
Welcome to the Craft CMS Stack Exchange Shannon, and thanks for returning to post an answer! :)
Matt Stein
CC BY-SA 4.0
2019-01-30T14:51:41.273Z
2019-01-30T14:51:41.273Z
Shannon
<p>Anyone else who ends up here - I just got this error while updating a Craft 2 site to 3. I fixed it by running <code>./craft migrate/all</code>. Looks like it works in the CLI but not the browser.</p>

CC BY-SA 4.0
2020-10-12T09:51:42.593Z
2020-10-12T09:51:42.593Z
darylknight
<p>I moved a Craft 3 site to a new server. The previous server was a plain vanilla Ubuntu 16 LTS LAMP stack. The new web server is a Bitnami Ubuntu 16 LTS with a LAP stack (no local MySQL). In the new environment I have setup the Craft 3 site to connect to the remote server via SSL. The SSL connection seems to be working fine, but I am getting the following error when I navigate to the site on the new server:</p>

<blockquote>
  <p>An Error occurred while handling another error:<br>
  craft\errors\SiteNotFoundException: No primary site exists in /opt/bitnami/apache2/vhosts/ijm.org/htdocs/vendor/craftcms/cms/src/services/Sites.php:422<br>
  Stack trace:<br>
      #0 /opt/bitnami/apache2/vhosts/ijm.org/htdocs/vendor/craftcms/cms/src/web/Request.php(1120): craft\services\Sites->getPrimarySite()</p>
</blockquote>

<p>I have tried adding a siteUrl setting in the general.php file, but that didn't help.</p>

<p>Does anyone have any ideas on how to fix this issue?</p>

<p>Thanks!</p>

<craft3>
Moved Craft 3 site to new server and getting "No primary site exists" error
# Moved Craft 3 site to new server and getting "No primary site exists" error

(Asked by: username_0 on 2019-01-29)

I moved a Craft 3 site to a new server. The previous server was a plain vanilla Ubuntu 16 LTS LAMP stack. The new web server is a Bitnami Ubuntu 16 LTS with a LAP stack (no local MySQL). In the new environment I have setup the Craft 3 site to connect to the remote server via SSL. The SSL connection seems to be working fine, but I am getting the following error when I navigate to the site on the new server:

> An Error occurred while handling another error:  
> craft\errors\SiteNotFoundException: No primary site exists in /opt/bitnami/apache2/vhosts/ijm.org/htdocs/vendor/craftcms/cms/src/services/Sites.php:422  
> Stack trace:  
> #0 /opt/bitnami/apache2/vhosts/ijm.org/htdocs/vendor/craftcms/cms/src/web/Request.php(1120): craft\services\Sites->getPrimarySite()

I have tried adding a siteUrl setting in the general.php file, but that didn't help.

Does anyone have any ideas on how to fix this issue?

Thanks!

**Tags:** craft3

---

## 2 answers

### Answer by username_0 on 2019-01-30. Score: 4

I was able to resolve this issue by reimporting the database.

> **Comments:**
> **username_1**: Welcome to the Craft CMS Stack Exchange Shannon, and thanks for returning to post an answer! :)  

---

### Answer by username_2 on 2020-10-12. Score: 1

Anyone else who ends up here - I just got this error while updating a Craft 2 site to 3. I fixed it by running `./craft migrate/all`. Looks like it works in the CLI but not the browser.


---

