# Trying to migrate to a new server with the current database and the same codebase

**URL:** <https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089>\
**Category:** Help me!\
**Tags:** deploy-environment\
**Created:** [March 16, 2023, 3:46pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089 "2023-03-16T15:46:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ofgsl](https://avatars.discourse-cdn.com/v4/letter/o/e79b87/32.png) [@ofgsl](https://community.forestadmin.com/u/ofgsl)\
**Post date:** [March 16, 2023, 3:46pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/1 "2023-03-16T15:46:26Z")

</div>

## Feature(s) impacted

setting up a new project or a new environment in the current project

## Observed behavior

When setting up a new project, deploying to production after setting up locally causes an “Unable to authenticate you” popup. The get request goes to the localhost:3310 and not to the remote server I defined in the Admin backend URL field.

Trying instead to create a new environment on my current project, results in getting redirected to the project selection page with a “Project not found” error

## Expected behavior

Creating a new project and deploying to production should direct the get requests for authentication to the server url I defined in the Admin backend URL field for the production environment.

Deploying a new environment in my current project should deploy the project and not kick me out of the project with a project not found error

## Failure Logs

## Context

New environment on current project:

- Project name: GSL\_Admin
- Team name: Developers
- Environment name: TEST23

new project:

- Project name: GSL\_Admin\_2023

- Team name: Operations

- Environment name: PRODUCTION  

- Agent (forest package) name & version: @forestadmin/agent": “^1.8.4”

- Database type: Mongoose

- Recent changes made on your end if any: Migrating the code and database to a new remote server

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [March 16, 2023, 4:24pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/2 "2023-03-16T16:24:18Z")

</div>

Hi @ofgsl and welcome in our community,

I’m going to check your project to see if I can find the issue. Let me a few minutes 🕵️‍♂️

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [March 16, 2023, 4:32pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/3 "2023-03-16T16:32:27Z")

</div>

Everything seems correct 🤔. DO you still experiment this issue ?

---

<div class="post-metadata">

**Author:** ![Sawfish\_Developers](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/sawfish_developers/32/5887_2.png) [@Sawfish\_Developers](https://community.forestadmin.com/u/Sawfish_Developers)\
**Post date:** [March 17, 2023, 6:54am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/4 "2023-03-17T06:54:19Z")

</div>

I’m new to forest admin and facing same issue. Why the authentication call back calls to localhost:3310? I’m tried to change my application url. But it’s still call the localhost:3310.

 ![Screenshot from 2023-03-17 12-22-48](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/7/7eb23ce20ab64219ac8f299c9a38a3b47f2698d0.png)

---

<div class="post-metadata">

**Author:** ![anon7284711](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@anon7284711](https://community.forestadmin.com/u/anon7284711)\
**Post date:** [March 17, 2023, 8:53am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/5 "2023-03-17T08:53:59Z")

</div>

Hello @ofgsl,

We are experiencing cache refresh issue on certain actions, I have manually refreshed your cache. Could you please tell me if you still encounter any issue on your environments ?

Best regards,

---

<div class="post-metadata">

**Author:** ![anon7284711](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@anon7284711](https://community.forestadmin.com/u/anon7284711)\
**Post date:** [March 17, 2023, 8:59am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/6 "2023-03-17T08:59:26Z")

</div>

Hello @Sawfish_Developers and welcome to our community !

I’m sorry to hear that you have issues with your configuration.  
For us to be able to help we will need more details as it appears to me you are not facing an issue with cache refreshing.

Could you please open a new topic with the template filled out ? Thanks

Best regards,

---

<div class="post-metadata">

**Author:** ![ofgsl](https://avatars.discourse-cdn.com/v4/letter/o/e79b87/32.png) [@ofgsl](https://community.forestadmin.com/u/ofgsl)\
**Post date:** [March 17, 2023, 9:09am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/7 "2023-03-17T09:09:16Z")

</div>

No, the problem with the authentication going through the local host still persists

---

<div class="post-metadata">

**Author:** ![anon7284711](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@anon7284711](https://community.forestadmin.com/u/anon7284711)\
**Post date:** [March 17, 2023, 9:31am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/8 "2023-03-17T09:31:47Z")

</div>

From what I can see, the configuration of your environment points to an url different from localhost:3310, and you should have no issue with cache refreshing.  
Can you please simply refresh your frontend ?

---

<div class="post-metadata">

**Author:** ![ofgsl](https://avatars.discourse-cdn.com/v4/letter/o/e79b87/32.png) [@ofgsl](https://community.forestadmin.com/u/ofgsl)\
**Post date:** [March 17, 2023, 9:49am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/9 "2023-03-17T09:49:53Z")

</div>

I did have an instance where it tried to authenticate with the server after refreshing, but then it reverted back to the localhost

---

<div class="post-metadata">

**Author:** ![anon7284711](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@anon7284711](https://community.forestadmin.com/u/anon7284711)\
**Post date:** [March 17, 2023, 9:59am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/10 "2023-03-17T09:59:21Z")

</div>

The behaviour of “reverting” to the older url was due to bad cache refreshing, you should no longer experience a similar issue. We’re sorry for the inconvenience.

Best regards,

---

<div class="post-metadata">

**Author:** ![ofgsl](https://avatars.discourse-cdn.com/v4/letter/o/e79b87/32.png) [@ofgsl](https://community.forestadmin.com/u/ofgsl)\
**Post date:** [March 17, 2023, 10:50am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/11 "2023-03-17T10:50:52Z")

</div>

I emptied the cache on my end and I still get the localhost authentication issue

---

<div class="post-metadata">

**Author:** ![anon7284711](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@anon7284711](https://community.forestadmin.com/u/anon7284711)\
**Post date:** [March 17, 2023, 11:06am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/12 "2023-03-17T11:06:42Z")

</div>

I was looking at your Production environment from GSL\_Admin\_2023, if you’re experiencing this issue on environment test\_23 from GSL\_Admin, it appears that your agent hasn’t reached our backend yet. Is the agent running ? Can it reach [https://api.forestadmin.com](https://api.forestadmin.com) ? Do you have any error log from your agent when running it ?

---

<div class="post-metadata">

**Author:** ![ofgsl](https://avatars.discourse-cdn.com/v4/letter/o/e79b87/32.png) [@ofgsl](https://community.forestadmin.com/u/ofgsl)\
**Post date:** [March 17, 2023, 11:37am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/13 "2023-03-17T11:37:19Z")

</div>

when trying to connect with the test\_23 from GSL\_Admin env\_secret, it hangs on waiting for your backend to run. when trying with the GSL\_Admin\_2023 Production env\_secret, it tries to authenticate through the localhost and through the server

---

<div class="post-metadata">

**Author:** ![ofgsl](https://avatars.discourse-cdn.com/v4/letter/o/e79b87/32.png) [@ofgsl](https://community.forestadmin.com/u/ofgsl)\
**Post date:** [March 17, 2023, 11:39am UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/14 "2023-03-17T11:39:00Z")

</div>

the test\_23 from GSL\_Admin, tries to authenticate through the server url on the Production environment and not through the new one I am trying to migrate to and defined in the Admin backend URL field

---

<div class="post-metadata">

**Author:** ![anon7284711](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@anon7284711](https://community.forestadmin.com/u/anon7284711)\
**Post date:** [March 17, 2023, 1:34pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/15 "2023-03-17T13:34:58Z")

</div>

It appears to me that both your test\_23 and Production environments point to the same backend URL, can you try to update the apiEndpoint of your test\_23 environment once more ?

---

<div class="post-metadata">

**Author:** ![ofgsl](https://avatars.discourse-cdn.com/v4/letter/o/e79b87/32.png) [@ofgsl](https://community.forestadmin.com/u/ofgsl)\
**Post date:** [March 17, 2023, 1:56pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/16 "2023-03-17T13:56:23Z")

</div>

They are pointing to the same URL because that is the new server I am trying to migrate to

---

<div class="post-metadata">

**Author:** ![ofgsl](https://avatars.discourse-cdn.com/v4/letter/o/e79b87/32.png) [@ofgsl](https://community.forestadmin.com/u/ofgsl)\
**Post date:** [March 17, 2023, 2:22pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/17 "2023-03-17T14:22:05Z")

</div>

I changed the url to other locations and it works, it sends the request to those locations but when I change it back to my server url, it reverts back to localhost

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [March 17, 2023, 2:29pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/18 "2023-03-17T14:29:37Z")

</div>

When you refresh your page with your web console open, can you give me the result of this call `https://api.development.forestadmin.com/api/projects/:projectId/environments` in the network tab ?

---

<div class="post-metadata">

**Author:** ![ofgsl](https://avatars.discourse-cdn.com/v4/letter/o/e79b87/32.png) [@ofgsl](https://community.forestadmin.com/u/ofgsl)\
**Post date:** [March 17, 2023, 2:39pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/19 "2023-03-17T14:39:57Z")

</div>

[Picture deleted]  
This is the response

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [March 17, 2023, 3:05pm UTC](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089/20 "2023-03-17T15:05:04Z")

</div>

This is the OPTION call, I need the GET one. Ad just send the response (without the query parameters 🙏 )

[Next page](https://community.forestadmin.com/t/trying-to-migrate-to-a-new-server-with-the-current-database-and-the-same-codebase/6089.md?page=2)
