# "You have been disconnected" connecting to Rails development environment

**URL:** <https://community.forestadmin.com/t/you-have-been-disconnected-connecting-to-rails-development-environment/6843>\
**Category:** Help me!\
**Created:** [November 17, 2023, 7:46pm UTC](https://community.forestadmin.com/t/you-have-been-disconnected-connecting-to-rails-development-environment/6843 "2023-11-17T19:46:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisingram](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/chrisingram/32/6661_2.png) [@chrisingram](https://community.forestadmin.com/u/chrisingram)\
**Post date:** [November 17, 2023, 7:46pm UTC](https://community.forestadmin.com/t/you-have-been-disconnected-connecting-to-rails-development-environment/6843/1 "2023-11-17T19:46:22Z")

</div>

## Feature(s) impacted

Accessing data

## Observed behavior

Whenever I try to access Forest Admin it shows me this screenshot:

 ![Screenshot 2023-11-17 at 19.31.17](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/c/cab8065aaac0ab1b71b6294fbbd95716c0584d69.png)

In dev tools, it shows a 401 unauthorized on the request to get data. There is also a CORS error on the preflight request, even though I have implemented Rack::Cors in Rails. Before I implemented Rack::Cors as suggested by the docs, there were more CORS errors.

## Expected behavior

Ability to view data

## Failure Logs

There are no errors the logs on the Rails side.

## Context

Using Rails 7, with forest\_liana 8. I have implemented Rack::Cors as per the docs.

- Project name: Basejam
- Team name: …
- Environment name: …
- Agent (forest package) name & version: forest\_liana 8.0.16
- Database type: postgresql
- Recent changes made on your end if any: …

---

<div class="post-metadata">

**Author:** ![anon34731316](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anon34731316](https://community.forestadmin.com/u/anon34731316)\
**Post date:** [November 20, 2023, 10:49am UTC](https://community.forestadmin.com/t/you-have-been-disconnected-connecting-to-rails-development-environment/6843/2 "2023-11-20T10:49:36Z")

</div>

Hello @chrisingram,

Thanks for reaching out 🙌

Something is unclear to me: were you able to connect before? Did you do something (upgrade your liana version, change a configuration, etc) that would trigger this connection issue?

Thanks.

---

<div class="post-metadata">

**Author:** ![chrisingram](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/chrisingram/32/6661_2.png) [@chrisingram](https://community.forestadmin.com/u/chrisingram)\
**Post date:** [November 20, 2023, 11:32am UTC](https://community.forestadmin.com/t/you-have-been-disconnected-connecting-to-rails-development-environment/6843/3 "2023-11-20T11:32:18Z")

</div>

Hey @anon34731316

I am coming back to an old account and project, that now has a new repo and a fresh install of forest\_liana.

However, I did also try setting up a new project from scratch, and the same thing is happening there.

Some interesting behaviour: it does load the schema and database fields somehow, but not the actual data.

Cheers

---

<div class="post-metadata">

**Author:** ![chrisingram](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/chrisingram/32/6661_2.png) [@chrisingram](https://community.forestadmin.com/u/chrisingram)\
**Post date:** [November 20, 2023, 12:11pm UTC](https://community.forestadmin.com/t/you-have-been-disconnected-connecting-to-rails-development-environment/6843/4 "2023-11-20T12:11:22Z")

</div>

Some more information:

I have added some logs to the forest\_liana gem code locally, and it logs fine for the authentication controller, but this log statement at the top of ForestLiana::Router::call is not logged for the data requests.

 ![Screenshot 2023-11-20 at 12.08.06](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/a/ab3c3b59fadb4e272b75fd597382351aec24a034.png)

So the data requests are not even getting to the router before they are rejected with 401.

---

<div class="post-metadata">

**Author:** ![anon34731316](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anon34731316](https://community.forestadmin.com/u/anon34731316)\
**Post date:** [November 20, 2023, 3:01pm UTC](https://community.forestadmin.com/t/you-have-been-disconnected-connecting-to-rails-development-environment/6843/5 "2023-11-20T15:01:07Z")

</div>

Hi @chrisingram,

Thanks for your answer.

So that we can help you out, could you please:

- share the logs you’re having when starting your agent?
- share the logs you’re having in your browser as well (which call in failing)?
- tell me if you well have this line `mount ForestLiana::Engine => '/forest'` in your `config/routes.rb` file?

Thanks.

---

<div class="post-metadata">

**Author:** ![chrisingram](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/chrisingram/32/6661_2.png) [@chrisingram](https://community.forestadmin.com/u/chrisingram)\
**Post date:** [November 21, 2023, 8:54am UTC](https://community.forestadmin.com/t/you-have-been-disconnected-connecting-to-rails-development-environment/6843/6 "2023-11-21T08:54:53Z")

</div>

Update:

I have narrowed this down to our authentication gem (Clerk) which has Rack middleware to intercept any request with a Bearer token and return 401 immediately if it doesn’t recognise it.

This is why the requests are not getting to the router logs before they are returned.

Took me a while to find that, as I assumed user authentication logic would be at the ApplicationController level. For anyone else landing here, it looks like you just need to add /forest/\* as an excluded route in the Clerk config.

Thanks for the help in the meantime!

---

<div class="post-metadata">

**Author:** ![anon34731316](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anon34731316](https://community.forestadmin.com/u/anon34731316)\
**Post date:** [November 21, 2023, 8:58am UTC](https://community.forestadmin.com/t/you-have-been-disconnected-connecting-to-rails-development-environment/6843/7 "2023-11-21T08:58:57Z")

</div>

@chrisingram thanks for sharing this!

Hope you’re fully up and running now.

Cheers!
