# Manage environments by CI/CD for Q&A

**URL:** <https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621>\
**Category:** Help me!\
**Created:** [August 31, 2023, 8:36am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621 "2023-08-31T08:36:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 8:36am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/1 "2023-08-31T08:36:08Z")

</div>

Hi 👋

I’m trying to achieve a Devops workflow between our Q&A Kubernetes and Forest.

We are already creating DEV env from localhost. The purpose here is to generate a Forest environment for Q&A when our PR Github generate our app for Q&A too.

I have created the K8 Forest pod and everything is ok thanks to Forest Toolbet. But when I’m going to my Forest environment I see a popin telling me “Unable to authenticate you. We can’t reach your server. Please check that your admin backend is correctly configured and running.”

I’ve tried to create a CLIENT ID from here [Running Forest Admin on multiple servers - Developer Guide](https://docs.forestadmin.com/documentation/extra-help/setup/running-forest-admin-on-multiple-servers) but I get every time a 500 ERROR.

 ![Screenshot 2023-08-31 at 10.31.37](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/d/de26b5422407002929344218e06d5e90c51ba2e8.png)

I need to understand how I can connect my K8 Forest Admin app to my Forest environment when I generate it by the Forest Toolbet.

Thanks 🙏

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [August 31, 2023, 8:59am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/2 "2023-08-31T08:59:04Z")

</div>

Hello,  
Can I have your project name please? It will help us to debug yourself.

This modal is displayed, when forestadmin does not have access to your agent. A lot of reasons can cause this problem (bad credentials, bad agent url etc.)

To find the cause of your problem, please,  
Can you open your `console` and share the trace of the failing requests?  
Can you see a request on your agent (admin backend) side?

🙏

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 9:39am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/3 "2023-08-31T09:39:11Z")

</div>

Hi @Alban_Bertolini 👋

My project: JULAYA\_DASHBOARD

On the console the failed request is localhost. It’s weird:

```javascript
http://localhost:3310/forest/authentication/callback?code=qboJE3bWTTdtsDo11eYS0Qc27g1ZHK77sNcntqWxaCHttf37cDs2G8DPERRCsBoV&state=%7B%22renderingId%22%3A217597%7D

```

Yes I can see logs when I’m refreshing the page with popin on Forest:

```javascript
Your application is listening on port 3310.
[forest] 🌳🌳🌳 Checking need for apimap update...
Your admin panel is available here: https://app.forestadmin.com/projects
[forest] 🌳🌳🌳 No change in apimap, nothing sent to Forest.
POST /forest/authentication 200 1020 - 138.629 ms
POST /forest/authentication 200 1020 - 10.591 ms
POST /forest/authentication 200 1020 - 2.606 ms
POST /forest/authentication 200 1020 - 2.966 ms

```

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [August 31, 2023, 9:45am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/4 "2023-08-31T09:45:20Z")

</div>

A dev environment can be in `localhost`. Only “remote” environment like a Production or a Staging env must be in public.

Can you share the request response please?

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 10:12am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/5 "2023-08-31T10:12:31Z")

</div>

Sorry, which request?

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [August 31, 2023, 10:14am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/6 "2023-08-31T10:14:05Z")

</div>

The frontend request, in your network section, you can find all the failing requests.

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 10:24am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/7 "2023-08-31T10:24:43Z")

</div>

Sorry but no response.

 ![Screenshot 2023-08-31 at 12.22.50](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/8/86e051a4dd4de1a8ecd16d25ef371fe320dda629.png)  
 ![Screenshot 2023-08-31 at 12.22.57](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/0/010a80da409980759c974f0a24e058328e770b1e.png)  
 ![Screenshot 2023-08-31 at 12.23.21](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/c/c7858f0123065ea3366eff9e0f21772225f55c94.png)

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 10:34am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/8 "2023-08-31T10:34:42Z")

</div>

Maybe I’m wrong in the workflow?

- I create environment by Forest Toolbet:

```javascript
${FOREST_CMD} login -e ${FOREST_AUTH_LOGIN} -t ${FOREST_AUTH_TOKEN}
FOREST_ENV_CONFIG=$(${FOREST_CMD} environments:create -p ${FOREST_PROJECT_ID} -n "${ENVIRONMENT_NAME}" -u "https://${EXTERNAL_URL}" --disableRoles --format=json)

```

- I get the secret and id from create env command

```javascript
  export FOREST_AUTH_SECRET=$(echo "${FOREST_ENV_CONFIG}" | ${JQ_CMD} -r '.authSecret')
  export FOREST_ENV_SECRET=$(echo "${FOREST_ENV_CONFIG}" | ${JQ_CMD} -r '.secretKey')
  export FOREST_ENVIRONMENT_ID=$(echo "${FOREST_ENV_CONFIG}" | ${JQ_CMD} -r '.id')

```

- I run the admin

```javascript
npm start

```

- I try to get FOREST\_CLIENT\_ID but always get a 500 error

```javascript
CODE=$(curl -o /dev/null -s -w '%{http_code}' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${FOREST_ENV_SECRET}" \
  -X POST \
  -d "{\token_endpoint_auth_method\": \"none\", \"redirect_uris\": [\"${EXTERNAL_URL}/forest/authentication/callback\"]}" \
  https://api.forestadmin.com/oidc/reg)

if [["${CODE}" =~ ^4 || "${CODE}" =~ ^5]]; then
  echo "ERROR: server returned HTTP code $CODE"
  exit 1
fi

```

So maybe I’m wrong somewhere?

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [August 31, 2023, 12:18pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/9 "2023-08-31T12:18:16Z")

</div>

Just for try, can you disable your ad blocker if you have one?

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 12:22pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/10 "2023-08-31T12:22:37Z")

</div>

Disabled and reloaded and nothing change

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [August 31, 2023, 12:24pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/11 "2023-08-31T12:24:06Z")

</div>

Does the request status is different? Because on your screenshot, the status was “(blocked:other)”.  
Also, Can you share your environment name please?

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 12:52pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/12 "2023-08-31T12:52:44Z")

</div>

Yes  
 ![Screenshot 2023-08-31 at 14.51.37](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/d/d1a6174d5ad9f4bc4562ee694627f4c0f6dd5ccd.png)

Env name: Qovery | blueprint

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [August 31, 2023, 1:37pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/13 "2023-08-31T13:37:41Z")

</div>

Please, can you run the curl command to get the CLIENT\_ID manually to check if the command works and avoid mistakes from your script?

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 3:23pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/14 "2023-08-31T15:23:52Z")

</div>

I’ve fixed the client id request and now I can write my env var FOREST\_CLIENT\_ID.

But no luck, I have always `Unable to authenticate you popin`

Maybe I miss a step?

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [August 31, 2023, 3:48pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/15 "2023-08-31T15:48:59Z")

</div>

It should be good.  
Can you share all the logs again 🙏 ? Front + back.

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 3:51pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/16 "2023-08-31T15:51:49Z")

</div>

Back

```javascript
> node ./server.js
Your application is listening on port 3310.
[forest] 🌳🌳🌳 Checking need for apimap update...
[forest] 🌳🌳🌳 No change in apimap, nothing sent to Forest.
Your admin panel is available here: https://app.forestadmin.com/projects
OPTIONS /forest/authentication 204 0 - 2.428 ms
POST /forest/authentication 200 1056 - 152.652 ms
POST /forest/authentication 200 1056 - 11.927 ms
POST /forest/authentication 200 1056 - 3.148 ms
POST /forest/authentication 200 1056 - 3.693 ms
POST /forest/authentication 200 1056 - 2.529 ms

```

On the other hand, in the front it will always look for a localhost

```javascript
{
    "errors": [
        {
            "status": 400,
            "detail": "The redirect uri must be one of https://myurl/forest/authentication/callback. Received \"http://localhost:3310/forest/authentication/callback\"",
            "meta": {},
            "name": "InvalidRedirectUriError"
        }
    ]
}

```

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [August 31, 2023, 4:18pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/17 "2023-08-31T16:18:46Z")

</div>

Can you anonymize your url please, because it can introduce securities issues.

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [August 31, 2023, 4:49pm UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/18 "2023-08-31T16:49:28Z")

</div>

Done, changed to myurl

---

<div class="post-metadata">

**Author:** ![Yoyoma](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@Yoyoma](https://community.forestadmin.com/u/Yoyoma)\
**Post date:** [September 1, 2023, 7:50am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/19 "2023-09-01T07:50:41Z")

</div>

@Alban_Bertolini Thank you very much for your time and patience for debugging with me. I have understand a little bit more thanks to you.

I’ve added APPLICATION\_URL to my env var and all is working now 🚀

---

<div class="post-metadata">

**Author:** ![Alban\_Bertolini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/alban_bertolini/32/1077_2.png) [@Alban\_Bertolini](https://community.forestadmin.com/u/Alban_Bertolini)\
**Post date:** [September 1, 2023, 8:11am UTC](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621/20 "2023-09-01T08:11:25Z")

</div>

🥳  
Great! I’m very happy to unblock you!

[Next page](https://community.forestadmin.com/t/manage-environments-by-ci-cd-for-q-a/6621.md?page=2)
